In TicTacToe example two modifications were added:
2. browser.browseResultsChangedHandler was updated with code to get the txt record:
With the help of Discovery.app I can see that tictactoe service with the txt record ("key1=value1") was successfully published, but NWBrowser returns .none for metadata instead of the TXT record object.
How can I get the TXT record from the published Bonjour service?
txtRecordObject was added to the listener:
Code Block swift listener.service?.txtRecordObject = NWTXTRecord(["key1": "value1"])
2. browser.browseResultsChangedHandler was updated with code to get the txt record:
Code Block swift browser.browseResultsChangedHandler = { results, changes in results.forEach { device in switch device.metadata { case .bonjour(let record): print(record) case .none: print("none") default: break } } self.delegate?.refreshResults(results: results) }
With the help of Discovery.app I can see that tictactoe service with the txt record ("key1=value1") was successfully published, but NWBrowser returns .none for metadata instead of the TXT record object.
How can I get the TXT record from the published Bonjour service?