Generated from iOS SDK 27.1. Availability is shown on each declaration; permissions and entitlements still apply.
Functions and constants
get · iOS 26.4+wifiAware
TypeScriptget wifiAware(): (WAConnection<SDKHandle>) | null
Swift declarationfinal var wifiAware: WAConnection<ApplicationProtocol>? { get }
Get the current connection information for Wi-Fi Aware if the connection is over Wi-Fi Aware, `nil` if it's not over Wi-Fi Aware.
method · iOS 26.4+wifiAware
TypeScriptwifiAwarePort(port: _Network_NWEndpoint_Port): (WAEndpoint) | null
Swift declarationfunc wifiAware(port: NWEndpoint.Port) -> WAEndpoint?
Get an `WAEndpoint` that can connect to this `NWEndpoint`'s remote device over Wi-Fi Aware on the specified port, or `nil` if the `NWEndpoint` is not compatible with Wi-Fi Aware.
The returned endpoint can be used to connect to a remote `NetworkListener` that accepts additional Wi-Fi Aware connections without publishing a service, via ``WiFiAware/WAPublisherListener/Action/addingConnections(from:)``
The returned endpoint will use Wi-Fi Aware as a transport.
- Parameter port: The port to use for this endpoint.
- Returns: A new endpoint that can be used to connect over Wi-Fi Aware, or `nil` if it not compatible with Wi-Fi Aware.
get · iOS 26.4+wifiAware
TypeScriptget wifiAware(): (WAEndpoint) | null
Swift declarationvar wifiAware: WAEndpoint? { get }
Get an `WAEndpoint` that can connect to this `NWEndpoint`'s remote device over Wi-Fi Aware, or `nil` if the `NWEndpoint` is not compatible with Wi-Fi Aware.
The returned endpoint can be used to connect to a remote `NetworkListener` that accepts additional Wi-Fi Aware connections without publishing a service, via ``WiFiAware/WAPublisherListener/Action/addingConnections(from:)``
The returned endpoint will use Wi-Fi Aware as a transport.
- Returns: A new endpoint that can be used to connect over Wi-Fi Aware, or `nil` if it not compatible with Wi-Fi Aware.
get · iOS 26.0+wifiAware
TypeScriptget wifiAware(): WAParameters
Swift declarationfinal var wifiAware: WAParameters { get set }
Get and set Wi-Fi Aware specific connection parameters.
If no Wi-Fi Aware specific properties were previously set, the ``WAParameters/defaults`` are assumed.
The following code is an example of creating the `NWParameters`, setting, and getting the WiFi Aware parameters.
```swift
// Create NWParameters
var networkParameters = NWParameters()
// Set Wi-Fi Aware Parameters
networkParameters.wifiAware = .defaults
// Get Wi-Fi Aware Parameters
let wifiAwareParameters = networkParameters.wifiAware
```
set · iOS 26.0+wifiAware
TypeScriptset wifiAware(value: WAParameters)
Swift declarationfinal var wifiAware: WAParameters { get set }
Get and set Wi-Fi Aware specific connection parameters.
If no Wi-Fi Aware specific properties were previously set, the ``WAParameters/defaults`` are assumed.
The following code is an example of creating the `NWParameters`, setting, and getting the WiFi Aware parameters.
```swift
// Create NWParameters
var networkParameters = NWParameters()
// Set Wi-Fi Aware Parameters
networkParameters.wifiAware = .defaults
// Get Wi-Fi Aware Parameters
let wifiAwareParameters = networkParameters.wifiAware
```
method · iOS 26.0+wifiAware
TypeScriptwifiAware7940(configurator: ((arg0: WAParameters) => void)): _Network_NWParameters
Swift declarationfinal func wifiAware(_ configurator: (inout WAParameters) -> Void) -> Self
Configure Wi-Fi Aware properties on an `NWParameters` object.
If not previously set, parameters will have ``WAParameters/defaults`` applied initially.
Example:
```swift
// Create NWParameters & apply wifiAware parameters
let networkParameters = NWParameters().wifiAware {
$0 = .defaults
}
```
- Parameter configurator: The function that will apply the desired `WAParameters` to the network parameters.
- Returns: the updated parameters, with the configured Wi-Fi Aware parameters applied.
get · iOS 26.0+wifiAware
TypeScriptget wifiAware(): Promise<(WAPath) | null>
Swift declarationvar wifiAware: WAPath? { get async throws }
Current status and performance information for Wi-Fi Aware, or `nil` if this path is not over Wi-Fi Aware.
> Throws: an error if the path could not be retrieved, or if the App does not have access to Wi-Fi Aware.
get · iOS 26.0+wifiAware
TypeScriptget wifiAware(): (WAError) | null
Swift declarationvar wifiAware: WAError? { get }
The underlying error that occurred, if applicable.
If the underlying connection is over Wi-Fi Aware and an error occurred, provide details on the specific error. Otherwise `nil`.
method · iOS 26.4+deriveSharedSecret
TypeScriptderiveSharedSecret(protocolName: WASharedSecret_ProtocolName, method: WASharedSecret_DerivationMethod, context?: WASharedSecret_Context): Promise<(WASharedSecret) | null>
Swift declarationfunc deriveSharedSecret(for protocolName: WASharedSecret.ProtocolName, method: WASharedSecret.DerivationMethod, context: WASharedSecret.Context = .bundleID) async -> WASharedSecret?
Derive a unique, high-entropy shared secret for this network connection, which can be used to pair and setup security for higher layer network protocols like TLS or IPSec without additional user action or entropy input.
The shared secret can be used to authenticate a [PAKE](https://en.wikipedia.org/wiki/Password-authenticated_key_agreement) like SPAKE2, which is then used to pair and derive long-term asymmetric keys for authentication and encryption of the upper-layer network protocol.
Both sides of a connection will derive the same shared secret value if the same connection and input parameters are used:
- Your app and a remote app can derive the same shared secret value by calling this function on the same connection, with the same parameters.
- Devices and accessories can derive the same value as your app by using the derivation specified in the Wi-Fi Aware 5.0 standard, and providing the same parameters as used by your app.
Example Usage:
```swift
let secret = await connection.wifiAware?.deriveSharedSecret(for: .tlsPSK, method: .kdfHash256)
```
>Important: If needed, get a new shared secret for each new network connection. Do not save this value, send it to other devices, reuse it across connections, or use it as a long-term authentication or encryption key. Instead, use this to pair higher layer protocols, and derive unique longer-term asymmetric keys for those protocols when pairing them.
- Parameters:
- protocolName: The protocol that will be setup, such as TLS, IPSec, or a custom protocol.
- method: The method to use to derive the shared secret.
- context: A unique value that is specific to your App and the use case this connection will perform, which diversifies the generated secret. Defaults to the `Bundle ID` of the calling app.
- Returns: a shared secret unique to the protocol, connection, and context supplied, or `nil` if a secret could not be derived using the provided method.