communicate with other iOS devices nearby
APACHE-2.0 License
communicate with other iOS devices nearby
MultipeerConnectivity,wifi()
Bonjour.swift
//bonjour
Bonjour.sharedBonjour.bonjour() // UIDevice.currentDevice().name
//
Bonjour.sharedBonjour.bonjour("")
Bonjour.sharedBonjour.sendMessage("message")
#####()
//BonjourDelegate
Bonjour.sharedBonjour.delegate = self
func didReceiveMessage(message: String,peerID:MCPeerID) {
//
}
func didConnectPeer(peerID: MCPeerID) {
//
}
func didDisconnectPeer(peerID: MCPeerID) {
//
}
#####()
NSNotificationCenter.defaultCenter().addObserverForName(BonjourDidReceiveMessageNotification, object: nil, queue: NSOperationQueue.mainQueue()) { (notification) -> Void in
//
let peerID = notification.userInfo?[BonjourNotificationPeerKey]
let message = notification.userInfo?[BonjourNotificationMessageKey]
}
NSNotificationCenter.defaultCenter().addObserverForName(BonjourDidConnectPeerNotification, object: nil, queue: NSOperationQueue.mainQueue()) { (notification) -> Void in
//
let peerID = notification.userInfo?[BonjourNotificationPeerKey]
}
NSNotificationCenter.defaultCenter().addObserverForName(BonjourDidDisconnectPeerNotification, object: nil, queue: NSOperationQueue.mainQueue()) { (notification) -> Void in
//
let peerID = notification.userInfo?[BonjourNotificationPeerKey]
}