descriptor
TypeScriptget descriptor(): NWBrowser_DescriptorSwift declarationfinal let descriptor: NWBrowser.DescriptorThe browse descriptor with which the browser was created.
class · iOS 13.0+ · SDK 27.1
final class NWBrowserAn NWBrowser discovers and tracks changes of advertised services in a local area network. Currently, only Bonjour services are supported. Whenever services become available, get modified, or go away, the browser will generate a set of browse results tracking those changes. The user may subscribe to and receive these updates as long as the browser is active.
get descriptor(): NWBrowser_DescriptorSwift declarationfinal let descriptor: NWBrowser.DescriptorThe browse descriptor with which the browser was created.
get parameters(): NWParametersSwift declarationfinal let parameters: NWParametersThe parameters with which the browser was created.
get browseResults(): Array<NWBrowser_Result>Swift declarationfinal var browseResults: Set<NWBrowser.Result> { get }The set of browse results representing a snapshot of the current services available on the network.
get debugDescription(): stringSwift declarationfinal var debugDescription: String { get }A textual representation of this instance, suitable for debugging. Calling this property directly is discouraged. Instead, convert an instance of any type to a string by using the `String(reflecting:)` initializer. This initializer works with any type, and uses the custom `debugDescription` property for types that conform to `CustomDebugStringConvertible`: struct Point: CustomDebugStringConvertible { let x: Int, y: Int var debugDescription: String { return "(\(x), \(y))" } } let p = Point(x: 21, y: 30) let s = String(reflecting: p) print(s) // Prints "(21, 30)" The conversion of `p` to a string in the assignment to `s` uses the `Point` type's `debugDescription` property.
get stateUpdateHandler(): (((arg0: NWBrowser_State) => Promise<void>)) | nullSwift declaration@preconcurrency final var stateUpdateHandler: (@Sendable (NWBrowser.State) -> Void)? { get set }Set a block to be called when the browser's state changes, which may be called multiple times until the browser is cancelled.
set stateUpdateHandler(value: (((arg0: NWBrowser_State) => void)) | null)Swift declaration@preconcurrency final var stateUpdateHandler: (@Sendable (NWBrowser.State) -> Void)? { get set }Set a block to be called when the browser's state changes, which may be called multiple times until the browser is cancelled.
get browseResultsChangedHandler(): (((arg0: Array<NWBrowser_Result>, arg1: Array<NWBrowser_Result_Change>) => Promise<void>)) | nullSwift declaration@preconcurrency final var browseResultsChangedHandler: (@Sendable (Set<NWBrowser.Result>, Set<NWBrowser.Result.Change>) -> Void)? { get set }Set a block to be called when the browser's set of browse results has been updated, which may be called multiple times until the browser is cancelled.
set browseResultsChangedHandler(value: (((arg0: Array<NWBrowser_Result>, arg1: Array<NWBrowser_Result_Change>) => void)) | null)Swift declaration@preconcurrency final var browseResultsChangedHandler: (@Sendable (Set<NWBrowser.Result>, Set<NWBrowser.Result.Change>) -> Void)? { get set }Set a block to be called when the browser's set of browse results has been updated, which may be called multiple times until the browser is cancelled.
static init(descriptor: NWBrowser_Descriptor, parameters: NWParameters): NWBrowserSwift declarationinit(for descriptor: NWBrowser.Descriptor, using parameters: NWParameters)Create a new browser that will browse for the service specified by a browse descriptor, with parameters. - Parameter descriptor: A browse descriptor describing the kind of service to browse for. - Parameter parameters: The parameters define which protocol and interfaces to use during browsing.
get queue(): (_Dispatch_DispatchQueue) | nullSwift declarationfinal var queue: DispatchQueue? { get }Get the queue used for delivering block handlers, such as the `stateUpdateHandler` and `browseResultsChangedHandler`. If the browser has not yet been started, the queue will be nil. Once the connection has been started, the queue will be non-nil.
start(queue: _Dispatch_DispatchQueue): voidSwift declarationfinal func start(queue: DispatchQueue)Start the browser and provide a dispatch queue for callback blocks. Starts the browser, which will cause the browser to begin browsing for services on the network. A `stateUpdateHandler` may be used to determine when the state changes. If the browser fails, the state will transition to failed with an associated `NWError` value. Otherwise, the state will transition to ready. `start()` should only be called once on a browser, and multiple calls to `start()` will be ignored. - Parameter queue: The dispatch queue on which browser callbacks will be delivered.
get state(): NWBrowser_StateSwift declarationfinal var state: NWBrowser.State { get }The current state of the browser.
cancel(): voidSwift declarationfinal func cancel()Cancel the browser, and cause all update handlers to be cancelled. `cancel()` is asynchronous. The last callback will be to the `stateUpdateHandler` with the cancelled state. After the cancelled state is delivered, all blocks are released to break retain cycles. Calls to `cancel()` after the first one are ignored. The browser cannot be restarted after it has been cancelled.
No declarations were skipped in this snapshot.