One Logo Pool Ball
Network · IOS API REFERENCE

NWListener.Service

struct · iOS 12.0+ · SDK 27.1

struct Service

Defines a service to advertise

Members (12)

init · iOS 16.0+

init

TypeScript
static initApplicationService(applicationService: string): NWListener_Service
Swift declaration
init(applicationService: String)

Create an Application service to advertise for the listener.

get · iOS 13.0+

noAutoRename

TypeScript
get noAutoRename(): boolean
Swift declaration
var noAutoRename: Bool { get set }

By default, advertised services may be automatically renamed if there is a conflict with other service names on the network. Set noAutoRename to true to disable this behavior.

set · iOS 13.0+

noAutoRename

TypeScript
set noAutoRename(value: boolean)
Swift declaration
var noAutoRename: Bool { get set }

By default, advertised services may be automatically renamed if there is a conflict with other service names on the network. Set noAutoRename to true to disable this behavior.

get · iOS 13.0+

txtRecordObject

TypeScript
get txtRecordObject(): (NWTXTRecord) | null
Swift declaration
var txtRecordObject: NWTXTRecord? { get set }

A convenience Bonjour TXT Record object. Setting this on an NWListener means it will advertise additional metadata about its service when the listener is active. An NWBrowser searching for the listener's service will be able to retrieve the metadata during browsing. Update the txtRecord by setting the service on the listener with the same name/type/domain and a new TXT record object.

set · iOS 13.0+

txtRecordObject

TypeScript
set txtRecordObject(value: (NWTXTRecord) | null)
Swift declaration
var txtRecordObject: NWTXTRecord? { get set }

A convenience Bonjour TXT Record object. Setting this on an NWListener means it will advertise additional metadata about its service when the listener is active. An NWBrowser searching for the listener's service will be able to retrieve the metadata during browsing. Update the txtRecord by setting the service on the listener with the same name/type/domain and a new TXT record object.

get · iOS 12.0+

debugDescription

TypeScript
get debugDescription(): string
Swift declaration
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.

init · iOS 12.0+

init

TypeScript
static initNameTypeDomainTxtRecord(name: (string) | null, type: string, domain?: (string) | null, txtRecord?: (ArrayBuffer) | null): NWListener_Service
Swift declaration
init(name: String? = nil, type: String, domain: String? = nil, txtRecord: Data? = nil)

Create a Service to advertise for the listener. Name, domain, and txtRecord all default to nil.

init · iOS 13.0+

init

TypeScript
static initNameTypeDomainTxtRecord45304(name: (string) | null, type: string, domain: (string) | null, txtRecord: NWTXTRecord): NWListener_Service
Swift declaration
init(name: String? = nil, type: String, domain: String? = nil, txtRecord: NWTXTRecord)

Create a Service to advertise for the listener with an NWTXTRecord. Name and domain default to nil.

get · iOS 12.0+

name

TypeScript
get name(): (string) | null
Swift declaration
let name: String?

Bonjour service name - if nil the system name will be used

get · iOS 12.0+

type

TypeScript
get type(): string
Swift declaration
let type: String

Bonjour service type

get · iOS 12.0+

domain

TypeScript
get domain(): (string) | null
Swift declaration
let domain: String?

Bonjour service domain - if nil the system will register in all appropriate domains

get · iOS 12.0+

txtRecord

TypeScript
get txtRecord(): (ArrayBuffer) | null
Swift declaration
let txtRecord: Data?

Bonjour txtRecord - metadata for the service. Update the txtRecord by setting the service on the listener with the same name/type/domain and a new txtRecord.

Skipped declarations

No declarations were skipped in this snapshot.

All Network types →