One Logo Pool Ball
WiFiAware · IOS API REFERENCE

WAPublishableService

struct · iOS 26.0+ · SDK 27.1

struct WAPublishableService

A service, hosted by your app, that remote devices can connect to. You specify the services your app uses in `Info.plist` via a dictionary under the <doc://com.apple.documentation/documentation/bundleresources/information-property-list/wifiawareservices> key: - Each _key_ in that dictionary is the full service name of a service, and the _value_ is a dictionary of configuration properties for that service. - If the configuration dictionary contains the `Publishable` key, the system creates a `WAPublishableService` is created for that service and makes it available in ``WAPublishableService/allServices``.

Members (4)

get · iOS 26.0+

allServices

TypeScript
static get allServices(): Record<string, WAPublishableService>
Swift declaration
static var allServices: [WAPublishableService.ID : WAPublishableService] { get }

A dictionary of all publishable services declared by your app, indexed by service name. The system populates the contents of this property from the values under the `Info.plist` key "`WiFiAwareServices`", with all entries that specify the `Publishable` configuration included. You can select a service from this property using the `serviceName` as the key to pull elements from the dictionary, or by using an extension as follows: ```swift // Index into the dictionary. let myService = WAPublishableService.allServices["_example-service._tcp"]! // Give the service a symbol name. extension WAPublishableService { public static var exampleService: WAPublishableService { allServices["_example-service._tcp"]! } } let myService = .exampleService ```

get · iOS 26.0+

description

TypeScript
get description(): string
Swift declaration
var description: String { get }

A description of the service.

get · iOS 26.0+

id

TypeScript
get id(): string
Swift declaration
var id: WAPublishableService.ID { get }

A stable ID that can be used to identify this publishable service. The ID is stable for a given unique service name.

get · iOS 26.0+

name

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

The full name of the service, as sent over the air. To avoid conflicts with other apps and devices that may prevent your app from using the service, register your service with a unique name in the [IANA Service Name Registry](https://www.iana.org/assignments/service-names-port-numbers/service-names-port-numbers.xml). For the service name to be valid, follow the rules located in [RFC 6763](https://datatracker.ietf.org/doc/html/rfc6763#section-4.1.2) and [RFC 6335](https://datatracker.ietf.org/doc/html/rfc6335#section-5.1). The RFC rules require that the service string have a unique name that conforms to the following rules: * Only use characters such as `a-z`, `A-Z`, `0 - 9`, and hyphen (`-`). * Use at least one letter `a-z`, `A-Z`. * Don't start or end with a hyphen (`-`). * Don't exceed 15 characters. The full service name string then: * Prepends an underscore (`_`) to the name component * Adds a dot (`.`) separator * Appends a protocol suffix of `_tcp` or `_udp` The table below shows some examples: Examples: | Name Component | Protocol Component | Full Service Name string | |-----------------------------|--------------------------|------------------------------------------| | `example-service` | `_tcp` | `_example-service._tcp` | | `example-service` | `_udp` | `_example-service._udp` | The name in the `Info.plist` must be this full service name, exactly as it is sent over-the-air. Invalid service names in the `Info.plist` will cause the app to crash.

Skipped declarations

No declarations were skipped in this snapshot.

All WiFiAware types →