MultipeerKit Documentation Beta

Structure Multipeer​Configuration

public struct MultipeerConfiguration

Configures several aspects of the multipeer communication.

Initializers

init(service​Type:​peer​Name:​defaults:​security:​invitation:​)

public init(serviceType: String, peerName: String, defaults: UserDefaults, security: Security, invitation: Invitation)

Creates a new configuration.

Parameters

service​Type String

This must be the same accross your app running on multiple devices, it must be a short string. Check Apple's docs on MCNearbyServiceAdvertiser for more info on the limitations for this field.

peer​Name String

A display name for this peer that will be shown to nearby peers.

defaults User​Defaults

An instance of UserDefaults that's used to store this peer's identity so that it remains stable between different sessions. If you use MultipeerKit in app extension make sure to use a shared app group if you wish to maintain a stable identity.

security Security

The security configuration.

invitation Invitation

Defines how the multipeer connection handles newly discovered peers. New peers can be invited automatically, invited with a custom context or not invited at all, in which case you must invite them manually.

Properties

service​Type

var serviceType: String

This must be the same accross your app running on multiple devices, it must be a short string.

Check Apple's docs on MCNearbyServiceAdvertiser for more info on the limitations for this field.

peer​Name

var peerName: String

A display name for this peer that will be shown to nearby peers.

defaults

var defaults: UserDefaults

An instance of UserDefaults that's used to store this peer's identity so that it remains stable between different sessions. If you use MultipeerKit in app extensions, make sure to use a shared app group if you wish to maintain a stable identity.

security

var security: Security

The security configuration.

invitation

var invitation: Invitation

Defines how the multipeer connection handles newly discovered peers.

`default`

let `default`

The default configuration, uses the service type MKSVC, the name of the device/computer as the display name, UserDefaults.standard, the default security configuration and automatic invitation.