---
title: "wifiAware(_:active:)"
framework: network
role: symbol
role_heading: Type Method
path: "network/listenerprovider/wifiaware(_:active:)"
---

# wifiAware(_:active:)

Sets a network listener to publish Wi-Fi Aware services to the selected paired devices.

## Declaration

```swift
static func wifiAware(_ action: WAPublisherListener.Action, active requestedDuration: Duration? = nil) -> Self
```

## Parameters

- `action`: The specific Wi-Fi Aware operation to perform, and the service & devices to perform it on.
- `requestedDuration`: Optional duration requested to keep the NetworkListener publishing. The default value of nil instructs the system to stay active for long enough to guarantee the action completes with all nearby target devices.

## Return Value

Return Value A new ListenerProvider containing the .wifiAware() instruction that will configure a NetworkListener as a Wi-Fi Aware publisher.

## Discussion

Discussion The code below is an example of how to set the NetworkListener: NetworkListener(for: .wifiAware(.connecting(to:service, from:.selected(devices))) )
