init(_:onSelect:label:fallback:parameters:)
Creates a view that displays available devices.
Declaration
@MainActor @preconcurrency init(_ browseDescriptor: NWBrowser.Descriptor, onSelect: @escaping (NWEndpoint) -> Void, @ViewBuilder label: () -> Label, @ViewBuilder fallback: () -> Fallback, parameters: (() -> NWParameters)? = nil)Parameters
- browseDescriptor:
A descriptor for your application service. To create an application service descriptor, call
NWBrowser.Descriptor.applicationService(name:options:)and provide a name for the service. - onSelect:
A closure that the framework calls when someone selects a device in the picker view, or cancels the view.
- label:
A label the network device picker displays.
- fallback:
A view that the framework displays if the current device doesn’t support device discovery.
- parameters:
Parameters for your network connection. Use Applicationservice to create a default set of parameters that create an encrypted connection with the other devices. You can also add a Nwprotocolframer to provide an application-level messaging protocol.