endpoint
A network connection endpoint for the device that a person selected.
Declaration
@MainActor @preconcurrency var endpoint: NWEndpoint { get async throws }Discussion
Your app can asynchronously read from this property. The system populates this property when someone selects a device from the endpoint picker. If someone cancels the picker, the system throws an error.
let endpoint: NWEndpoint
do {
endpoint = try await myEndpointPickerHandler.endpoint
} catch {
// Someone canceled the endpoint picker view.
return
}
// Use the endpoint here.
myDeviceConnectionManager.connectTo(endpoint: endpoint)