Documentation Archive Developer
Search

MultipeerConnectivity Changes for Swift

MultipeerConnectivity

Declaration
From
class MCAdvertiserAssistant : NSObject {
    init!(serviceType serviceType: String!, discoveryInfo info: [NSObject : AnyObject]!, session session: MCSession!)
    func start()
    func stop()
    weak var delegate: MCAdvertiserAssistantDelegate!
    var session: MCSession! { get }
    var discoveryInfo: [NSObject : AnyObject]! { get }
    var serviceType: String! { get }
}
To
class MCAdvertiserAssistant : NSObject {
    init(serviceType serviceType: String, discoveryInfo info: [String : String]?, session session: MCSession)
    func start()
    func stop()
    weak var delegate: MCAdvertiserAssistantDelegate?
    var session: MCSession { get }
    var discoveryInfo: [String : String]? { get }
    var serviceType: String { get }
}

Declaration
From
weak var delegate: MCAdvertiserAssistantDelegate!
To
weak var delegate: MCAdvertiserAssistantDelegate?

Declaration
From
var discoveryInfo: [NSObject : AnyObject]! { get }
To
var discoveryInfo: [String : String]? { get }

Declaration
From
init!(serviceType serviceType: String!, discoveryInfo info: [NSObject : AnyObject]!, session session: MCSession!)
To
init(serviceType serviceType: String, discoveryInfo info: [String : String]?, session session: MCSession)

Declaration
From
var serviceType: String! { get }
To
var serviceType: String { get }

Declaration
From
var session: MCSession! { get }
To
var session: MCSession { get }

Declaration
From
protocol MCAdvertiserAssistantDelegate : NSObjectProtocol {
    optional func advertiserAssistantWillPresentInvitation(_ advertiserAssistant: MCAdvertiserAssistant!)
    optional func advertiserAssistantDidDismissInvitation(_ advertiserAssistant: MCAdvertiserAssistant!)
}
To
protocol MCAdvertiserAssistantDelegate : NSObjectProtocol {
    optional func advertiserAssistantWillPresentInvitation(_ advertiserAssistant: MCAdvertiserAssistant)
    optional func advertiserAssistantDidDismissInvitation(_ advertiserAssistant: MCAdvertiserAssistant)
}

Declaration
From
optional func advertiserAssistantDidDismissInvitation(_ advertiserAssistant: MCAdvertiserAssistant!)
To
optional func advertiserAssistantDidDismissInvitation(_ advertiserAssistant: MCAdvertiserAssistant)

Declaration
From
optional func advertiserAssistantWillPresentInvitation(_ advertiserAssistant: MCAdvertiserAssistant!)
To
optional func advertiserAssistantWillPresentInvitation(_ advertiserAssistant: MCAdvertiserAssistant)

Declaration
From
class MCBrowserViewController : NSViewController, MCNearbyServiceBrowserDelegate, NSObjectProtocol {
    convenience init!(serviceType serviceType: String!, session session: MCSession!)
    init!(browser browser: MCNearbyServiceBrowser!, session session: MCSession!)
    weak var delegate: MCBrowserViewControllerDelegate!
    var browser: MCNearbyServiceBrowser! { get }
    var session: MCSession! { get }
    var minimumNumberOfPeers: Int
    var maximumNumberOfPeers: Int
}
To
class MCBrowserViewController : NSViewController, MCNearbyServiceBrowserDelegate {
    convenience init(serviceType serviceType: String, session session: MCSession)
    init(browser browser: MCNearbyServiceBrowser, session session: MCSession)
    weak var delegate: MCBrowserViewControllerDelegate?
    var browser: MCNearbyServiceBrowser { get }
    var session: MCSession { get }
    var minimumNumberOfPeers: Int
    var maximumNumberOfPeers: Int
}

Declaration
From
var browser: MCNearbyServiceBrowser! { get }
To
var browser: MCNearbyServiceBrowser { get }

Declaration
From
weak var delegate: MCBrowserViewControllerDelegate!
To
weak var delegate: MCBrowserViewControllerDelegate?

Declaration
From
init!(browser browser: MCNearbyServiceBrowser!, session session: MCSession!)
To
init(browser browser: MCNearbyServiceBrowser, session session: MCSession)

Declaration
From
convenience init!(serviceType serviceType: String!, session session: MCSession!)
To
convenience init(serviceType serviceType: String, session session: MCSession)

Declaration
From
var session: MCSession! { get }
To
var session: MCSession { get }

Declaration
From
protocol MCBrowserViewControllerDelegate : NSObjectProtocol {
    func browserViewControllerDidFinish(_ browserViewController: MCBrowserViewController!)
    func browserViewControllerWasCancelled(_ browserViewController: MCBrowserViewController!)
    optional func browserViewController(_ browserViewController: MCBrowserViewController!, shouldPresentNearbyPeer peerID: MCPeerID!, withDiscoveryInfo info: [NSObject : AnyObject]!) -> Bool
}
To
protocol MCBrowserViewControllerDelegate : NSObjectProtocol {
    func browserViewControllerDidFinish(_ browserViewController: MCBrowserViewController)
    func browserViewControllerWasCancelled(_ browserViewController: MCBrowserViewController)
    optional func browserViewController(_ browserViewController: MCBrowserViewController, shouldPresentNearbyPeer peerID: MCPeerID, withDiscoveryInfo info: [String : String]?) -> Bool
}

Declaration
From
optional func browserViewController(_ browserViewController: MCBrowserViewController!, shouldPresentNearbyPeer peerID: MCPeerID!, withDiscoveryInfo info: [NSObject : AnyObject]!) -> Bool
To
optional func browserViewController(_ browserViewController: MCBrowserViewController, shouldPresentNearbyPeer peerID: MCPeerID, withDiscoveryInfo info: [String : String]?) -> Bool

Declaration
From
func browserViewControllerDidFinish(_ browserViewController: MCBrowserViewController!)
To
func browserViewControllerDidFinish(_ browserViewController: MCBrowserViewController)

Declaration
From
func browserViewControllerWasCancelled(_ browserViewController: MCBrowserViewController!)
To
func browserViewControllerWasCancelled(_ browserViewController: MCBrowserViewController)

Raw Value Type
From--
ToInt

DeclarationProtocolsRaw Value Type
From
enum MCErrorCode : Int {
    case Unknown
    case NotConnected
    case InvalidParameter
    case Unsupported
    case TimedOut
    case Cancelled
    case Unavailable
}
Equatable, Hashable, RawRepresentable--
To
enum MCErrorCode : Int {
    case Unknown
    case NotConnected
    case InvalidParameter
    case Unsupported
    case TimedOut
    case Cancelled
    case Unavailable
}
extension MCErrorCode : Hashable, Equatable, __BridgedNSError, ErrorType, RawRepresentable, _ObjectiveCBridgeableErrorType, _BridgedNSError {
}
extension MCErrorCode : Hashable, Equatable, __BridgedNSError, ErrorType, RawRepresentable, _ObjectiveCBridgeableErrorType, _BridgedNSError {
}
Equatable, ErrorType, Hashable, RawRepresentableInt

Declaration
From
class MCNearbyServiceAdvertiser : NSObject {
    init!(peer myPeerID: MCPeerID!, discoveryInfo info: [NSObject : AnyObject]!, serviceType serviceType: String!)
    func startAdvertisingPeer()
    func stopAdvertisingPeer()
    weak var delegate: MCNearbyServiceAdvertiserDelegate!
    var myPeerID: MCPeerID! { get }
    var discoveryInfo: [NSObject : AnyObject]! { get }
    var serviceType: String! { get }
}
To
class MCNearbyServiceAdvertiser : NSObject {
    init(peer myPeerID: MCPeerID, discoveryInfo info: [String : String]?, serviceType serviceType: String)
    func startAdvertisingPeer()
    func stopAdvertisingPeer()
    weak var delegate: MCNearbyServiceAdvertiserDelegate?
    var myPeerID: MCPeerID { get }
    var discoveryInfo: [String : String]? { get }
    var serviceType: String { get }
}

Declaration
From
weak var delegate: MCNearbyServiceAdvertiserDelegate!
To
weak var delegate: MCNearbyServiceAdvertiserDelegate?

Declaration
From
var discoveryInfo: [NSObject : AnyObject]! { get }
To
var discoveryInfo: [String : String]? { get }

Declaration
From
init!(peer myPeerID: MCPeerID!, discoveryInfo info: [NSObject : AnyObject]!, serviceType serviceType: String!)
To
init(peer myPeerID: MCPeerID, discoveryInfo info: [String : String]?, serviceType serviceType: String)

Declaration
From
var myPeerID: MCPeerID! { get }
To
var myPeerID: MCPeerID { get }

Declaration
From
var serviceType: String! { get }
To
var serviceType: String { get }

Declaration
From
protocol MCNearbyServiceAdvertiserDelegate : NSObjectProtocol {
    func advertiser(_ advertiser: MCNearbyServiceAdvertiser!, didReceiveInvitationFromPeer peerID: MCPeerID!, withContext context: NSData!, invitationHandler invitationHandler: ((Bool, MCSession!) -> Void)!)
    optional func advertiser(_ advertiser: MCNearbyServiceAdvertiser!, didNotStartAdvertisingPeer error: NSError!)
}
To
protocol MCNearbyServiceAdvertiserDelegate : NSObjectProtocol {
    func advertiser(_ advertiser: MCNearbyServiceAdvertiser, didReceiveInvitationFromPeer peerID: MCPeerID, withContext context: NSData?, invitationHandler invitationHandler: (Bool, MCSession) -> Void)
    optional func advertiser(_ advertiser: MCNearbyServiceAdvertiser, didNotStartAdvertisingPeer error: NSError)
}

Declaration
From
optional func advertiser(_ advertiser: MCNearbyServiceAdvertiser!, didNotStartAdvertisingPeer error: NSError!)
To
optional func advertiser(_ advertiser: MCNearbyServiceAdvertiser, didNotStartAdvertisingPeer error: NSError)

Declaration
From
func advertiser(_ advertiser: MCNearbyServiceAdvertiser!, didReceiveInvitationFromPeer peerID: MCPeerID!, withContext context: NSData!, invitationHandler invitationHandler: ((Bool, MCSession!) -> Void)!)
To
func advertiser(_ advertiser: MCNearbyServiceAdvertiser, didReceiveInvitationFromPeer peerID: MCPeerID, withContext context: NSData?, invitationHandler invitationHandler: (Bool, MCSession) -> Void)

Declaration
From
class MCNearbyServiceBrowser : NSObject {
    init!(peer myPeerID: MCPeerID!, serviceType serviceType: String!)
    func startBrowsingForPeers()
    func stopBrowsingForPeers()
    func invitePeer(_ peerID: MCPeerID!, toSession session: MCSession!, withContext context: NSData!, timeout timeout: NSTimeInterval)
    weak var delegate: MCNearbyServiceBrowserDelegate!
    var myPeerID: MCPeerID! { get }
    var serviceType: String! { get }
}
To
class MCNearbyServiceBrowser : NSObject {
    init(peer myPeerID: MCPeerID, serviceType serviceType: String)
    func startBrowsingForPeers()
    func stopBrowsingForPeers()
    func invitePeer(_ peerID: MCPeerID, toSession session: MCSession, withContext context: NSData?, timeout timeout: NSTimeInterval)
    weak var delegate: MCNearbyServiceBrowserDelegate?
    var myPeerID: MCPeerID { get }
    var serviceType: String { get }
}

Declaration
From
weak var delegate: MCNearbyServiceBrowserDelegate!
To
weak var delegate: MCNearbyServiceBrowserDelegate?

Declaration
From
init!(peer myPeerID: MCPeerID!, serviceType serviceType: String!)
To
init(peer myPeerID: MCPeerID, serviceType serviceType: String)

Declaration
From
func invitePeer(_ peerID: MCPeerID!, toSession session: MCSession!, withContext context: NSData!, timeout timeout: NSTimeInterval)
To
func invitePeer(_ peerID: MCPeerID, toSession session: MCSession, withContext context: NSData?, timeout timeout: NSTimeInterval)

Declaration
From
var myPeerID: MCPeerID! { get }
To
var myPeerID: MCPeerID { get }

Declaration
From
var serviceType: String! { get }
To
var serviceType: String { get }

Declaration
From
protocol MCNearbyServiceBrowserDelegate : NSObjectProtocol {
    func browser(_ browser: MCNearbyServiceBrowser!, foundPeer peerID: MCPeerID!, withDiscoveryInfo info: [NSObject : AnyObject]!)
    func browser(_ browser: MCNearbyServiceBrowser!, lostPeer peerID: MCPeerID!)
    optional func browser(_ browser: MCNearbyServiceBrowser!, didNotStartBrowsingForPeers error: NSError!)
}
To
protocol MCNearbyServiceBrowserDelegate : NSObjectProtocol {
    func browser(_ browser: MCNearbyServiceBrowser, foundPeer peerID: MCPeerID, withDiscoveryInfo info: [String : String]?)
    func browser(_ browser: MCNearbyServiceBrowser, lostPeer peerID: MCPeerID)
    optional func browser(_ browser: MCNearbyServiceBrowser, didNotStartBrowsingForPeers error: NSError)
}

Declaration
From
optional func browser(_ browser: MCNearbyServiceBrowser!, didNotStartBrowsingForPeers error: NSError!)
To
optional func browser(_ browser: MCNearbyServiceBrowser, didNotStartBrowsingForPeers error: NSError)

Declaration
From
func browser(_ browser: MCNearbyServiceBrowser!, foundPeer peerID: MCPeerID!, withDiscoveryInfo info: [NSObject : AnyObject]!)
To
func browser(_ browser: MCNearbyServiceBrowser, foundPeer peerID: MCPeerID, withDiscoveryInfo info: [String : String]?)

Declaration
From
func browser(_ browser: MCNearbyServiceBrowser!, lostPeer peerID: MCPeerID!)
To
func browser(_ browser: MCNearbyServiceBrowser, lostPeer peerID: MCPeerID)

Modified MCPeerID
Declaration
From
class MCPeerID : NSObject, NSCopying, NSSecureCoding, NSCoding {
    init!(displayName myDisplayName: String!)
    var displayName: String! { get }
}
To
class MCPeerID : NSObject, NSCopying, NSSecureCoding, NSCoding {
    init(displayName myDisplayName: String)
    var displayName: String { get }
}

Declaration
From
var displayName: String! { get }
To
var displayName: String { get }

Declaration
From
init!(displayName myDisplayName: String!)
To
init(displayName myDisplayName: String)

Modified MCSession
Declaration
From
class MCSession : NSObject {
    convenience init!(peer myPeerID: MCPeerID!)
    init!(peer myPeerID: MCPeerID!, securityIdentity identity: [AnyObject]!, encryptionPreference encryptionPreference: MCEncryptionPreference)
    func sendData(_ data: NSData!, toPeers peerIDs: [AnyObject]!, withMode mode: MCSessionSendDataMode, error error: NSErrorPointer) -> Bool
    func disconnect()
    func sendResourceAtURL(_ resourceURL: NSURL!, withName resourceName: String!, toPeer peerID: MCPeerID!, withCompletionHandler completionHandler: ((NSError!) -> Void)!) -> NSProgress!
    func startStreamWithName(_ streamName: String!, toPeer peerID: MCPeerID!, error error: NSErrorPointer) -> NSOutputStream!
    weak var delegate: MCSessionDelegate!
    var myPeerID: MCPeerID! { get }
    var securityIdentity: [AnyObject]! { get }
    var encryptionPreference: MCEncryptionPreference { get }
    var connectedPeers: [AnyObject]! { get }
}
extension MCSession {
    func nearbyConnectionDataForPeer(_ peerID: MCPeerID!, withCompletionHandler completionHandler: ((NSData!, NSError!) -> Void)!)
    func connectPeer(_ peerID: MCPeerID!, withNearbyConnectionData data: NSData!)
    func cancelConnectPeer(_ peerID: MCPeerID!)
}
To
class MCSession : NSObject {
    convenience init(peer myPeerID: MCPeerID)
    init(peer myPeerID: MCPeerID, securityIdentity identity: [AnyObject]?, encryptionPreference encryptionPreference: MCEncryptionPreference)
    func sendData(_ data: NSData, toPeers peerIDs: [MCPeerID], withMode mode: MCSessionSendDataMode) throws
    func disconnect()
    func sendResourceAtURL(_ resourceURL: NSURL, withName resourceName: String, toPeer peerID: MCPeerID, withCompletionHandler completionHandler: ((NSError?) -> Void)?) -> NSProgress?
    func startStreamWithName(_ streamName: String, toPeer peerID: MCPeerID) throws -> NSOutputStream
    weak var delegate: MCSessionDelegate?
    var myPeerID: MCPeerID { get }
    var securityIdentity: [AnyObject]? { get }
    var encryptionPreference: MCEncryptionPreference { get }
    var connectedPeers: [MCPeerID] { get }
}
extension MCSession {
    func nearbyConnectionDataForPeer(_ peerID: MCPeerID, withCompletionHandler completionHandler: (NSData, NSError?) -> Void)
    func connectPeer(_ peerID: MCPeerID, withNearbyConnectionData data: NSData)
    func cancelConnectPeer(_ peerID: MCPeerID)
}

Declaration
From
func cancelConnectPeer(_ peerID: MCPeerID!)
To
func cancelConnectPeer(_ peerID: MCPeerID)

Declaration
From
var connectedPeers: [AnyObject]! { get }
To
var connectedPeers: [MCPeerID] { get }

Declaration
From
func connectPeer(_ peerID: MCPeerID!, withNearbyConnectionData data: NSData!)
To
func connectPeer(_ peerID: MCPeerID, withNearbyConnectionData data: NSData)

Declaration
From
weak var delegate: MCSessionDelegate!
To
weak var delegate: MCSessionDelegate?

Declaration
From
convenience init!(peer myPeerID: MCPeerID!)
To
convenience init(peer myPeerID: MCPeerID)

Declaration
From
init!(peer myPeerID: MCPeerID!, securityIdentity identity: [AnyObject]!, encryptionPreference encryptionPreference: MCEncryptionPreference)
To
init(peer myPeerID: MCPeerID, securityIdentity identity: [AnyObject]?, encryptionPreference encryptionPreference: MCEncryptionPreference)

Declaration
From
var myPeerID: MCPeerID! { get }
To
var myPeerID: MCPeerID { get }

Declaration
From
func nearbyConnectionDataForPeer(_ peerID: MCPeerID!, withCompletionHandler completionHandler: ((NSData!, NSError!) -> Void)!)
To
func nearbyConnectionDataForPeer(_ peerID: MCPeerID, withCompletionHandler completionHandler: (NSData, NSError?) -> Void)

Declaration
From
var securityIdentity: [AnyObject]! { get }
To
var securityIdentity: [AnyObject]? { get }

Declaration
From
func sendData(_ data: NSData!, toPeers peerIDs: [AnyObject]!, withMode mode: MCSessionSendDataMode, error error: NSErrorPointer) -> Bool
To
func sendData(_ data: NSData, toPeers peerIDs: [MCPeerID], withMode mode: MCSessionSendDataMode) throws

Declaration
From
func sendResourceAtURL(_ resourceURL: NSURL!, withName resourceName: String!, toPeer peerID: MCPeerID!, withCompletionHandler completionHandler: ((NSError!) -> Void)!) -> NSProgress!
To
func sendResourceAtURL(_ resourceURL: NSURL, withName resourceName: String, toPeer peerID: MCPeerID, withCompletionHandler completionHandler: ((NSError?) -> Void)?) -> NSProgress?

Declaration
From
func startStreamWithName(_ streamName: String!, toPeer peerID: MCPeerID!, error error: NSErrorPointer) -> NSOutputStream!
To
func startStreamWithName(_ streamName: String, toPeer peerID: MCPeerID) throws -> NSOutputStream

Declaration
From
protocol MCSessionDelegate : NSObjectProtocol {
    func session(_ session: MCSession!, peer peerID: MCPeerID!, didChangeState state: MCSessionState)
    func session(_ session: MCSession!, didReceiveData data: NSData!, fromPeer peerID: MCPeerID!)
    func session(_ session: MCSession!, didReceiveStream stream: NSInputStream!, withName streamName: String!, fromPeer peerID: MCPeerID!)
    func session(_ session: MCSession!, didStartReceivingResourceWithName resourceName: String!, fromPeer peerID: MCPeerID!, withProgress progress: NSProgress!)
    func session(_ session: MCSession!, didFinishReceivingResourceWithName resourceName: String!, fromPeer peerID: MCPeerID!, atURL localURL: NSURL!, withError error: NSError!)
    optional func session(_ session: MCSession!, didReceiveCertificate certificate: [AnyObject]!, fromPeer peerID: MCPeerID!, certificateHandler certificateHandler: ((Bool) -> Void)!)
}
To
protocol MCSessionDelegate : NSObjectProtocol {
    func session(_ session: MCSession, peer peerID: MCPeerID, didChangeState state: MCSessionState)
    func session(_ session: MCSession, didReceiveData data: NSData, fromPeer peerID: MCPeerID)
    func session(_ session: MCSession, didReceiveStream stream: NSInputStream, withName streamName: String, fromPeer peerID: MCPeerID)
    func session(_ session: MCSession, didStartReceivingResourceWithName resourceName: String, fromPeer peerID: MCPeerID, withProgress progress: NSProgress)
    func session(_ session: MCSession, didFinishReceivingResourceWithName resourceName: String, fromPeer peerID: MCPeerID, atURL localURL: NSURL, withError error: NSError?)
    optional func session(_ session: MCSession, didReceiveCertificate certificate: [AnyObject]?, fromPeer peerID: MCPeerID, certificateHandler certificateHandler: (Bool) -> Void)
}

Declaration
From
func session(_ session: MCSession!, didFinishReceivingResourceWithName resourceName: String!, fromPeer peerID: MCPeerID!, atURL localURL: NSURL!, withError error: NSError!)
To
func session(_ session: MCSession, didFinishReceivingResourceWithName resourceName: String, fromPeer peerID: MCPeerID, atURL localURL: NSURL, withError error: NSError?)

Declaration
From
optional func session(_ session: MCSession!, didReceiveCertificate certificate: [AnyObject]!, fromPeer peerID: MCPeerID!, certificateHandler certificateHandler: ((Bool) -> Void)!)
To
optional func session(_ session: MCSession, didReceiveCertificate certificate: [AnyObject]?, fromPeer peerID: MCPeerID, certificateHandler certificateHandler: (Bool) -> Void)

Declaration
From
func session(_ session: MCSession!, didReceiveData data: NSData!, fromPeer peerID: MCPeerID!)
To
func session(_ session: MCSession, didReceiveData data: NSData, fromPeer peerID: MCPeerID)

Declaration
From
func session(_ session: MCSession!, didReceiveStream stream: NSInputStream!, withName streamName: String!, fromPeer peerID: MCPeerID!)
To
func session(_ session: MCSession, didReceiveStream stream: NSInputStream, withName streamName: String, fromPeer peerID: MCPeerID)

Declaration
From
func session(_ session: MCSession!, didStartReceivingResourceWithName resourceName: String!, fromPeer peerID: MCPeerID!, withProgress progress: NSProgress!)
To
func session(_ session: MCSession, didStartReceivingResourceWithName resourceName: String, fromPeer peerID: MCPeerID, withProgress progress: NSProgress)

Declaration
From
func session(_ session: MCSession!, peer peerID: MCPeerID!, didChangeState state: MCSessionState)
To
func session(_ session: MCSession, peer peerID: MCPeerID, didChangeState state: MCSessionState)

Raw Value Type
From--
ToInt

Raw Value Type
From--
ToInt