Issue #873

Use assistant

let assistant = MCAdvertiserAssistant(serviceType: "my-service, discoveryInfo: nil, session: mcSession)
assistant.start()

let browser = MCBrowserViewController(serviceType: "my-service", session: mcSession)
browser.delegate = self
present(browser, animated: true)

Manual

let advertiser = MCNearbyServiceAdvertiser(peer: localPeerID, discoveryInfo: nil, serviceType: self.serviceType)
advertiser.startAdvertisingPeer()

let browser = MCNearbyServiceBrowser(peer: localPeerID, serviceType: self.serviceType)
browser.startBrowsingForPeers()

Enable in Info.plist

<key>NSLocalNetworkUsageDescription</key>
<string>Enable local network discovery to use Peer Share</string>
<key>NSBonjourServices</key>
<array>
    <string>_my-service._tcp</string>
    <string>_my-service._udp</string>
</array>

Read more