Structure
MultipeerConfiguration
public struct MultipeerConfiguration
Configures several aspects of the multipeer communication.
Relationships
Nested Types
MultipeerConfiguration.Invitation
Defines how the multipeer connection handles newly discovered peers. New peers can be invited automatically, invited with a custom context and timeout, or not invited at all, in which case you must invite them manually.
MultipeerConfiguration.Security
Configures security-related aspects of the multipeer connection.
Initializers
init(serviceType:peerName:defaults:security:invitation:)
public init(serviceType: String, peerName: String, defaults: UserDefaults, security: Security, invitation: Invitation)
Creates a new configuration.
Parameters
Name | Type | Description |
---|---|---|
serviceType | String |
|
peerName | String |
|
defaults | UserDefaults |
|
security | Security |
|
invitation | Invitation |
|
Properties
serviceType
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.
peerName
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.