MultiPeer
public class MultiPeer : NSObjectextension MultiPeer: MCNearbyServiceAdvertiserDelegateextension MultiPeer: MCNearbyServiceBrowserDelegateextension MultiPeer: MCSessionDelegateMain Class for MultiPeer
- 
                  
                  Singleton instance - call via MultiPeer.instance DeclarationSwift public static let instance: MultiPeer
- 
                  
                  Conforms to MultiPeerDelegate: Handles receiving data and changes in connections DeclarationSwift public weak var delegate: MultiPeerDelegate?
- 
                  
                  Amount of time to spend connecting before timeout DeclarationSwift public var connectionTimeout: Double
- 
                  
                  Peers available to connect to DeclarationSwift public var availablePeers: [Peer]
- 
                  
                  Peers connected to DeclarationSwift public var connectedPeers: [Peer]
- 
                  
                  Names of all connected devices DeclarationSwift public var connectedDeviceNames: [String] { get }
- 
                  
                  Prints out all errors and status updates DeclarationSwift public var debugMode: Bool
- 
                  
                  Initializes the MultiPeer service with a serviceType and the default deviceName DeclarationSwift public func initialize(serviceType: String)ParametersserviceTypeString with name of MultiPeer service. Up to one hyphen (-) and 15 characters. Uses default device name 
- 
                  
                  Initializes the MultiPeer service with a serviceType and a custom deviceName DeclarationSwift public func initialize(serviceType: String, deviceName: String)ParametersserviceTypeString with name of MultiPeer service. Up to one hyphen (-) and 15 characters. deviceNameString containing custom name for device 
- 
                  
                  HOST: Automatically browses and invites all found devices DeclarationSwift public func startInviting()
- 
                  
                  JOIN: Automatically advertises and accepts all invites DeclarationSwift public func startAccepting()
- 
                  
                  HOST and JOIN: Uses both advertising and browsing to connect. DeclarationSwift public func autoConnect()
- 
                  
                  Stops the invitation process DeclarationSwift public func stopInviting()
- 
                  
                  Stops accepting invites and becomes invisible on the network DeclarationSwift public func stopAccepting()
- 
                  
                  Stops all invite/accept services DeclarationSwift public func stopSearching()
- 
                  
                  Disconnects from the current session and stops all searching activity DeclarationSwift public func disconnect()
- 
                  
                  Stops all invite/accept services, disconnects from the current session, and stops all searching activity DeclarationSwift public func end()
- 
                  
                  Returns true if there are any connected peers DeclarationSwift public var isConnected: Bool { get }
- 
                  
                  Sends an object (and type) to all connected peers. DeclarationSwift public func send(object: Any, type: UInt32)ParametersobjectObject (Any) to send to all connected peers. typeType of data (UInt32) sent After sending the object, you can use the extension for Data, convertData()to convert it back into an object.
- 
                  
                  Sends Data (and type) to all connected peers. DeclarationSwift public func send(data: Data, type: UInt32)ParametersdataData (Data) to send to all connected peers. typeType of data (UInt32) sent After sending the data, you can use the extension for Data, convertData()to convert it back into data.
- 
                  
                  Received invitation DeclarationSwift public func advertiser(_ advertiser: MCNearbyServiceAdvertiser, didReceiveInvitationFromPeer peerID: MCPeerID, withContext context: Data?, invitationHandler: @escaping (Bool, MCSession?) -> Void)
- 
                  
                  Error, could not start advertising DeclarationSwift public func advertiser(_ advertiser: MCNearbyServiceAdvertiser, didNotStartAdvertisingPeer error: Error)
- 
                  
                  Found a peer, update the list of available peers DeclarationSwift public func browser(_ browser: MCNearbyServiceBrowser, foundPeer peerID: MCPeerID, withDiscoveryInfo info: [String : String]?)
- 
                  
                  Lost a peer, update the list of available peers DeclarationSwift public func browser(_ browser: MCNearbyServiceBrowser, lostPeer peerID: MCPeerID)
- 
                  
                  Error, could not start browsing DeclarationSwift public func browser(_ browser: MCNearbyServiceBrowser, didNotStartBrowsingForPeers error: Error)
- 
                  
                  Peer changed state, update all connected peers and send new connection list to delegate connectedDevicesChanged DeclarationSwift public func session(_ session: MCSession, peer peerID: MCPeerID, didChange state: MCSessionState)
- 
                  
                  Received data, update delegate didRecieveData DeclarationSwift public func session(_ session: MCSession, didReceive data: Data, fromPeer peerID: MCPeerID)
- 
                  
                  Received stream DeclarationSwift public func session(_ session: MCSession, didReceive stream: InputStream, withName streamName: String, fromPeer peerID: MCPeerID)
- 
                  
                  Started receiving resource DeclarationSwift public func session(_ session: MCSession, didStartReceivingResourceWithName resourceName: String, fromPeer peerID: MCPeerID, with progress: Progress)
- 
                  
                  Finished receiving resource DeclarationSwift public func session(_ session: MCSession, didFinishReceivingResourceWithName resourceName: String, fromPeer peerID: MCPeerID, at localURL: URL?, withError error: Error?)
 View on GitHub
View on GitHub MultiPeer Class Reference
        MultiPeer Class Reference