<!--
{
  "availability" : [
    "iOS: 12.0.0 -",
    "iPadOS: 12.0.0 -",
    "macCatalyst: 12.0.0 -",
    "macOS: 10.14.0 -",
    "tvOS: 12.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 5.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Network",
  "identifier" : "/documentation/Network/NWListener/Service-swift.struct",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "Network"
    ],
    "preciseIdentifier" : "s:7Network10NWListenerC7ServiceV"
  },
  "title" : "NWListener.Service"
}
-->

# NWListener.Service

A description used to advertise the Bonjour service that a listener provides.

```
struct Service
```

## Topics

### Defining Services

[`init(name: String?, type: String, domain: String?, txtRecord: Data?)`](/documentation/Network/NWListener/Service-swift.struct/init(name:type:domain:txtRecord:)-1lb30)

Initializes a Bonjour service to advertise.

[`init(name: String?, type: String, domain: String?, txtRecord: NWTXTRecord)`](/documentation/Network/NWListener/Service-swift.struct/init(name:type:domain:txtRecord:)-8qh5)

Initializes a Bonjour service to advertise with a TXT record.

[`var noAutoRename: Bool`](/documentation/Network/NWListener/Service-swift.struct/noAutoRename)

A Boolean that indicates whether the service prohibits automatic renaming in the event of a name conflict.

### Inspecting Services

[`let name: String?`](/documentation/Network/NWListener/Service-swift.struct/name)

The Bonjour name of the service.

[`let type: String`](/documentation/Network/NWListener/Service-swift.struct/type)

The Bonjour type of the service.

[`let domain: String?`](/documentation/Network/NWListener/Service-swift.struct/domain)

The Bonjour domain of the service.

[`var txtRecordObject: NWTXTRecord?`](/documentation/Network/NWListener/Service-swift.struct/txtRecordObject)

The TXT record to advertise with the service.

[`let txtRecord: Data?`](/documentation/Network/NWListener/Service-swift.struct/txtRecord)

The TXT record as a raw buffer to advertise with the service.

### Initializers

[`init(applicationService: String)`](/documentation/Network/NWListener/Service-swift.struct/init(applicationService:))

Creates a listener for apps that listen for connections from a network device picker.

## Relationships

### Conforms To

[`Equatable`](/documentation/Swift/Equatable)

[`CustomDebugStringConvertible`](/documentation/Swift/CustomDebugStringConvertible)

[`Sendable`](/documentation/Swift/Sendable)

[`SendableMetatype`](/documentation/Swift/SendableMetatype)

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)