---
title: "init(for:)"
framework: wifiinfrastructure
role: symbol
role_heading: Initializer
path: "wifiinfrastructure/winetworksharingcontroller/init(for:)"
---

# init(for:)

Creates a controller for a given accessory.

## Declaration

```swift
init(for accessory: ASAccessory) async throws
```

## Parameters

- `accessory`: The accessory to send requests to.

## Discussion

Discussion Use this initializer to create a network-sharing controller for the specified accessory. The accessory needs to be connected and using a secure transport when creating the controller. note: A WINetworkSharingError for various conditions: WINetworkSharingError.accessoryTransportNotSecured: The accessory isn’t using a secure Bluetooth transport. WINetworkSharingError.accessoryNotConnected: The accessory isn’t connected when your container app calls this method. WINetworkSharingError.wifiNetworkSharingUnsupported: Network sharing isn’t supported on this device.
