### Start Nearby Interaction Session
Source: https://developer.apple.com/documentation/nearbyinteraction/nisession/run%28_%3A%29
Call this method to start an interaction session with a nearby peer. Ensure the device supports the required features by inspecting `deviceCapabilities` before calling. The framework may prompt the user for permission on the first launch.
```swift
func run(_ configuration: NIConfiguration)
```
--------------------------------
### run(_:)
Source: https://developer.apple.com/documentation/nearbyinteraction/nisession/run%28_%3A%29
Starts a session with a nearby peer, configuring its features. The framework handles user permission prompts on the first launch and respects user preferences on subsequent calls.
```APIDOC
## run(_:)
### Description
Starts a session with a nearby peer.
### Method
Instance Method
### Signature
```swift
func run(_ configuration: NIConfiguration)
```
### Parameters
#### Parameters
- **configuration** (NIConfiguration) - Required - An object that indicates an interaction session’s features.
### Discussion
This function starts an interaction session between two devices. Before calling this function, ensure the device supports the features your app requires by first inspecting global `deviceCapabilities`. To restart a session as the result of unpausing, call this function as described in `pause()`. The app calls this function when resuming from session suspension, as described in `sessionSuspensionEnded(_:)`. A session’s `discoveryToken` maintains its original value through restarts. The framework prompts for user permission to provide its relative position to nearby peers when it calls this function the first time the app launches. On subsequent calls to this function, the framework consults a preference in Settings that stores the user’s decision.
### See Also
- `var discoveryToken: NIDiscoveryToken?`
- `class NIDiscoveryToken`
- `var configuration: NIConfiguration?`
- `var delegateQueue: dispatch_queue_t?`
```
--------------------------------
### Reacting to session start
Source: https://developer.apple.com/documentation/nearbyinteraction/nisessiondelegate
Notifies the app when a session starts or resumes running.
```APIDOC
## sessionDidStartRunning(NISession)
### Description
Notifies the app when a session starts or resumes running.
### Method
`sessionDidStartRunning`
### Parameters
- **session** (NISession) - The session that started running.
```
--------------------------------
### Start Nearby Interaction Session
Source: https://developer.apple.com/documentation/nearbyinteraction/nidiscoverytoken
This function starts a session with a nearby peer using a specified NIConfiguration. Ensure the configuration is correctly set up before calling this function.
```swift
func run(NIConfiguration)
```
--------------------------------
### sessionDidStartRunning(_:)
Source: https://developer.apple.com/documentation/nearbyinteraction/nisessiondelegate/sessiondidstartrunning%28_%3A%29
This method is called when the `NISession` starts or resumes running. It provides the session object that is now active.
```APIDOC
## sessionDidStartRunning(_:)
### Description
Notifies the app when a session starts or resumes running.
### Parameters
#### session
- **session** (NISession) - The session that starts or resumes running.
### Availability
iOS 16.0+ iPadOS 16.0+ Mac Catalyst 16.0+ watchOS 9.0+
```
--------------------------------
### sessionDidStartRunning(_:)
Source: https://developer.apple.com/documentation/nearbyinteraction/nisessiondelegate/sessiondidstartrunning%28_%3A%29
Implement this method to receive a notification when an NISession starts or resumes running. The `session` parameter provides the session object that is now active.
```swift
optional func sessionDidStartRunning(_ session: NISession)
```
--------------------------------
### Session Did Start Running
Source: https://developer.apple.com/documentation/nearbyinteraction/nisessiondelegate
Notifies the app when a Nearby Interaction session starts or resumes running.
```swift
func sessionDidStartRunning(_ session: NISession)
```
--------------------------------
### Get Convergence Status Reason Description (Objective-C)
Source: https://developer.apple.com/documentation/nearbyinteraction/nialgorithmconvergencestatusreasondescription
Use this function to obtain a descriptive string for a given `NIAlgorithmConvergenceStatusReason`. Available on iOS, iPadOS, Mac Catalyst, and watchOS starting from version 16.0.
```Objective-C
extern NSString *NIAlgorithmConvergenceStatusReasonDescription(NIAlgorithmConvergenceStatusReason const reason);
```
--------------------------------
### Initialize Nearby Interaction Session
Source: https://developer.apple.com/documentation/nearbyinteraction/finding-devices-with-precision
Sets up the ARKit and Multipeer Connectivity frameworks required to start ranging for peer devices. This includes creating an NISession, setting its delegate, and initiating the peer discovery process.
```swift
func startup() {
// The initial view.
Task { @MainActor in
self.updateViewState(with: nil, quality: .unknown, nearbyObject: nil, worldTransform: nil, showUpDownText: false)
}
// Create the interaction session.
session = NISession()
session?.delegateQueue = sessionQueue
// Set a delegate.
session?.delegate = self
// Because this is a new session, reset the token-shared flag.
sharedTokenWithPeer = false
connectedPeer = nil
// Start multipeer connectivity (MPC) to discover peers.
startupMPC()
}
```
--------------------------------
### Get Session Configuration
Source: https://developer.apple.com/documentation/nearbyinteraction/nidiscoverytoken
This property holds the configuration object used by the session. It defines parameters for the nearby interaction.
```swift
var configuration: NIConfiguration?
```
--------------------------------
### NIAlgorithmConvergenceStatus.converged Case
Source: https://developer.apple.com/documentation/nearbyinteraction/nialgorithmconvergencestatus-2fnve/converged
Use this case to check if the Camera Assistance feature is operational. No setup or imports are required beyond the Nearby Interaction framework.
```swift
case converged
```
--------------------------------
### NIDLTDOAConfiguration.DiscoveryMethod.wifi
Source: https://developer.apple.com/documentation/nearbyinteraction/nidltdoaconfiguration/discoverymethod-swift.enum/wifi
A method to discover DL-TDOA anchors using Wi-Fi. Available on iOS, iPadOS, and Mac Catalyst starting from version 27.0.
```APIDOC
## NIDLTDOAConfiguration.DiscoveryMethod.wifi
A method to discover DL-TDOA anchors using Wi-Fi.
iOS 27.0+Beta
iPadOS 27.0+Beta
Mac Catalyst 27.0+Beta
```swift
case wifi
```
```
--------------------------------
### Initialize NIAlgorithmConvergence with NSCoder
Source: https://developer.apple.com/documentation/nearbyinteraction/nialgorithmconvergence/init%28coder%3A%29
Use this initializer to unarchive an instance of NIAlgorithmConvergence from an NSCoder. Available on iOS, iPadOS, Mac Catalyst, and watchOS starting from version 16.0/9.0.
```swift
init?(coder: NSCoder)
```
--------------------------------
### Restart Session on Timeout
Source: https://developer.apple.com/documentation/nearbyinteraction/nisessiondelegate/session%28_%3Adidremove%3Areason%3A%29
Handle object removal due to timeout by checking the reason and restarting the session if appropriate. This example checks if the reason is `.timeout` and then attempts to restart the session with its existing configuration.
```swift
func session(_ session: NISession, didRemove nearbyObjects: [NINearbyObject],
reason: NINearbyObject.RemovalReason) {
// Only retry if the peer timed out.
guard reason == .timeout else { return }
// The session runs with one accessory.
guard let peer = nearbyObjects.first else { return }
if shouldResume(peer) {
// Restart the session.
if let config = session.configuration {
session.run(config)
}
}
}
```
--------------------------------
### Handling Accessory Motion State Updates
Source: https://developer.apple.com/documentation/nearbyinteraction/nisession/updatemotionstate%28_%3Aforobjectwithtoken%3A%29
Example of how to use the `updateMotionState` method within a session to report an accessory's motion state. This function should be called when the accessory's motion state changes.
```swift
func handleMotionStateUpdate(_ state: NIMotionActivityState, session: NISession) {
guard let config = session.configuration as? NINearbyAccessoryConfiguration else {
return
}
session.updateMotionState(state, forObjectWithToken: config.accessoryDiscoveryToken)
}
```
--------------------------------
### Get NIAlgorithmConvergenceStatus
Source: https://developer.apple.com/documentation/nearbyinteraction/nialgorithmconvergence/status-654t
Retrieves the current state of the framework's Camera Assistance feature. Available on iOS 16.0+, iPadOS 16.0+, Mac Catalyst, and watchOS 9.0+.
```swift
var status: NIAlgorithmConvergenceStatus { get }
```
--------------------------------
### Get measurementType
Source: https://developer.apple.com/documentation/nearbyinteraction/nidltdoameasurement/measurementtype
Retrieve the type of anchor message for the measurement. Available on iOS, iPadOS, and Mac Catalyst starting from version 26.0.
```swift
var measurementType: NIDLTDOAMeasurementType { get }
```
--------------------------------
### Initializer
Source: https://developer.apple.com/documentation/nearbyinteraction/ninearbypeerconfiguration/init%28peertoken%3A%29
Creates a configuration for interaction between devices, including iPhone and Apple Watch.
```APIDOC
## init(peerToken:)
### Description
Creates a configuration for interaction between devices, including iPhone and Apple Watch.
### Parameters
#### Path Parameters
* **peerToken** (NIDiscoveryToken) - Required - The value of another device’s discovery token. This value uniquely identifies the other peer in the interaction session.
```
--------------------------------
### Get Responder Clock Frequency Offset
Source: https://developer.apple.com/documentation/nearbyinteraction/nidltdoameasurement/responderclockfrequencyoffset-8wu5r
Access the clock frequency offset of the responder anchor relative to the initiator anchor. This property is available on iOS, iPadOS, and Mac Catalyst starting from version 27.0.
```swift
var responderClockFrequencyOffset: Double? { get }
```
--------------------------------
### Creating a configuration for UWB accessories
Source: https://developer.apple.com/documentation/nearbyinteraction/ninearbyaccessoryconfiguration
Initializes a configuration for UWB accessory interaction.
```APIDOC
## `init(data: Data) throws`
### Description
Creates a configuration for interaction between iPhone and third-party accessories.
### Parameters
#### Request Body
- **data** (Data) - Required - Raw accessory data.
```
```APIDOC
## `init(accessoryData: Data, bluetoothPeerIdentifier: UUID) throws`
### Description
Creates a configuration for an accessory with the given Bluetooth peer identifier.
### Parameters
#### Request Body
- **accessoryData** (Data) - Required - Raw accessory data.
- **bluetoothPeerIdentifier** (UUID) - Required - The Bluetooth peer identifier of the accessory.
```
--------------------------------
### Get Unsupported Platform Error Code
Source: https://developer.apple.com/documentation/nearbyinteraction/nierror/unsupportedplatform
Access the `unsupportedPlatform` error code to check for framework compatibility on the current device. Always call `isSupported` before starting an interaction session to ensure platform support.
```swift
static var unsupportedPlatform: NIError.Code { get }
```
--------------------------------
### Creating a Configuration
Source: https://developer.apple.com/documentation/nearbyinteraction/ninearbypeerconfiguration
Initializes a new NINearbyPeerConfiguration instance for device interaction.
```APIDOC
## init(peerToken: NIDiscoveryToken)
### Description
Creates a configuration for interaction between devices, including iPhone and Apple Watch.
### Parameters
- **peerToken** (NIDiscoveryToken) - Required - A value that uniquely identifies the other peer in the interaction session.
```
--------------------------------
### Creating a configuration for Bluetooth Channel Sounding accessories
Source: https://developer.apple.com/documentation/nearbyinteraction/ninearbyaccessoryconfiguration
Initializes a configuration for Bluetooth Channel Sounding ranging.
```APIDOC
## `init(bluetoothChannelSoundingIdentifier: UUID, previousBluetoothIdentifier: UUID?)`
### Description
Initializes a configuration for Bluetooth Channel Sounding ranging with an accessory.
### Parameters
#### Request Body
- **bluetoothChannelSoundingIdentifier** (UUID) - Required - The Bluetooth Channel Sounding identifier.
- **previousBluetoothIdentifier** (UUID) - Optional - The previous Bluetooth identifier.
```
--------------------------------
### init(bluetoothChannelSoundingIdentifier:previousBluetoothIdentifier:)
Source: https://developer.apple.com/documentation/nearbyinteraction/ninearbyaccessoryconfiguration/init%28bluetoothchannelsoundingidentifier%3Apreviousbluetoothidentifier%3A%29
Initializes a configuration for Bluetooth Channel Sounding ranging with an accessory. Use this to create an accessory configuration that implements Bluetooth Channel Sounding. For initial connections, pass nil for previousBluetoothIdentifier. For reconnections, provide the previous identifier to maintain internal state continuity.
```APIDOC
## init(bluetoothChannelSoundingIdentifier:previousBluetoothIdentifier:)
### Description
Initializes a configuration for Bluetooth Channel Sounding ranging with an accessory.
### Method
Initializer
### Parameters
#### Path Parameters
* **bluetoothChannelSoundingIdentifier** (UUID) - Required - The Bluetooth identifier for Channel Sounding.
* **previousBluetoothIdentifier** (UUID?) - Optional - An optional previous Bluetooth identifier for reconnection scenarios.
### Discussion
Bluetooth Channel Sounding is a Bluetooth 6.0 specification ranging strategy that measures distance between iPhone and a paired accessory over a standard Bluetooth connection without requiring dedicated Ultra Wideband hardware. Use this initializer to create an accessory configuration that implements Bluetooth Channel Sounding. Call `supportsBluetoothChannelSounding` before running a session to ensure device support, and pair your accessory with AccessorySetupKit; the Nearby Interaction framework only supports Bluetooth Channel Sounding with accessories paired through AccessorySetupKit.
Handle reconnections: When reconnecting to an accessory where the Bluetooth identifier can change, provide the previous identifier using the `previousBluetoothIdentifier` parameter. This allows the session to maintain internal state continuity across reconnections. For initial connections, pass `nil` for this parameter.
### Request Example
```swift
// Initial connection.
let config = NINearbyAccessoryConfiguration(
bluetoothChannelSoundingIdentifier: btcsIdentifier,
previousBluetoothIdentifier: nil
)
session.run(config)
// Reconnection with a new identifier.
let reconnectConfig = NINearbyAccessoryConfiguration(
bluetoothChannelSoundingIdentifier: newBtcsIdentifier,
previousBluetoothIdentifier: previousBtcsIdentifier
)
session.run(reconnectConfig)
```
```
--------------------------------
### Initialize NINearbyPeerConfiguration
Source: https://developer.apple.com/documentation/nearbyinteraction/ninearbypeerconfiguration/init%28peertoken%3A%29
Use this initializer to create a configuration for device-to-device interaction. You must provide the discovery token of the peer device.
```swift
init(peerToken: NIDiscoveryToken)
```
--------------------------------
### Coaching the user
Source: https://developer.apple.com/documentation/nearbyinteraction/nisessiondelegate
Provides recommendations for user actions to improve Camera Assistance.
```APIDOC
## session(NISession, didUpdateAlgorithmConvergence: NIAlgorithmConvergence, for: NINearbyObject?)
### Description
Provides recommended actions the user can take to facilitate the framework’s Camera Assistance.
### Method
`session(_:didUpdateAlgorithmConvergence:for:)`
### Parameters
- **session** (NISession) - The session that updated the algorithm convergence.
- **algorithmConvergence** (NIAlgorithmConvergence) - The convergence status and recommendations.
- **nearbyObject** (NINearbyObject?) - The nearby object associated with the convergence update, if any.
```
--------------------------------
### Get Signal Strength
Source: https://developer.apple.com/documentation/nearbyinteraction/nidltdoameasurement/signalstrength
Retrieve the received signal strength in dBm from the anchor. This property is read-only.
```swift
var signalStrength: Double { get }
```
--------------------------------
### init(data:)
Source: https://developer.apple.com/documentation/nearbyinteraction/ninearbyaccessoryconfiguration/init%28data%3A%29
Creates a configuration for interaction between iPhone and third-party accessories. Available on iOS 15.0+, iPadOS 15.0+, Mac Catalyst 15.0+, and watchOS 8.0+.
```APIDOC
## init(data:)
### Description
Creates a configuration for interaction between iPhone and third-party accessories.
### Method Signature
```swift
init(data: Data) throws
```
### Parameters
#### Parameters
- **data** (Data) - Required - The accessory’s configuration data formatted to the Ultra Wideband (UWB) third-party device specification.
```
--------------------------------
### Create and Run DL-TDOA Configuration
Source: https://developer.apple.com/documentation/nearbyinteraction/nidltdoaconfiguration/init%28networkidentifier%3Adiscoverymethod%3A%29
Use this snippet to create a DL-TDOA configuration with a specific network identifier and discovery method (e.g., Wi-Fi) and then run a session with it.
```swift
let configuration = NIDLTDOAConfiguration(
networkIdentifier: 1,
discoveryMethod: .wifi
)
session.run(configuration)
```
--------------------------------
### NISession.configuration
Source: https://developer.apple.com/documentation/nearbyinteraction/nisession/configuration
The configuration object used by the session. This property is set by the system and reflects the configuration passed when starting the session.
```APIDOC
## Instance Property
# configuration
The configuration run by the session.
iOS 14.0+iPadOS 14.0+Mac Catalyst 14.0+watchOS 7.3+
```swift
@NSCopying
var configuration: NIConfiguration? { get }
```
### Discussion
An app doesn’t set this property. Instead, NI sets its value to reflect the object that the app passed in to `run(_:)`.
```
--------------------------------
### Get Carrier Frequency Offset
Source: https://developer.apple.com/documentation/nearbyinteraction/nidltdoameasurement/carrierfrequencyoffset
Retrieve the drift, as a ratio, across the frequencies of the receiver and the anchor. This property is read-only.
```swift
var carrierFrequencyOffset: Double { get }
```
--------------------------------
### Create Nearby Accessory Configuration
Source: https://developer.apple.com/documentation/nearbyinteraction/initiating-and-maintaining-a-session
Initialize a configuration object for a peer accessory using its configuration data.
```swift
configuration = try NINearbyAccessoryConfiguration(data: configData)
```
--------------------------------
### Initialize with Accessory Data and Bluetooth Identifier
Source: https://developer.apple.com/documentation/nearbyinteraction/ninearbyaccessoryconfiguration
Initializes a configuration for background interaction with Bluetooth accessories. Pass the accessory's Bluetooth identifier to enable hands-free experiences.
```swift
init(accessoryData: bluetoothPeerIdentifier:)
```
--------------------------------
### Get Anchor Coordinates
Source: https://developer.apple.com/documentation/nearbyinteraction/nidltdoameasurement/coordinates
Access the 3D coordinates of the anchor providing the measurement. The interpretation of these coordinates is determined by the `coordinatesType` property.
```swift
var coordinates: simd_double3 { get }
```
--------------------------------
### NINearbyAccessoryConfiguration Initializer
Source: https://developer.apple.com/documentation/nearbyinteraction/ninearbyaccessoryconfiguration/init%28data%3A%29
Use this initializer to create a configuration for Nearby Interaction with third-party accessories. The accessory's configuration data must be formatted according to the Ultra Wideband (UWB) third-party device specification.
```swift
init(data: Data) throws
```
--------------------------------
### Initialize with UWB Configuration Data
Source: https://developer.apple.com/documentation/nearbyinteraction/ninearbyaccessoryconfiguration
Initializes a configuration for UWB accessories using data provided by the accessory. The accessory must format this data according to the Ultra Wideband (UWB) third-party device specification.
```swift
init(data:)
```
--------------------------------
### session(_:didUpdateAlgorithmConvergence:for:)
Source: https://developer.apple.com/documentation/nearbyinteraction/nisessiondelegate/session%28_%3Adidupdatealgorithmconvergence%3Afor%3A%29
This delegate method is called when the framework invokes Camera Assistance, providing the current convergence state and user recommendations.
```APIDOC
## session(_:didUpdateAlgorithmConvergence:for:)
### Description
Provides recommended actions the user can take to facilitate the framework’s Camera Assistance.
### Parameters
#### Parameters
- **session** (NISession) - The session for which the app leverages Camera Assistance.
- **convergence** (NIAlgorithmConvergence) - The framework’s state and user recommendations for Camera Assistance.
- **object** (NINearbyObject?) - The peer device or third-party accessory. If `nil`, the status refers to the session.
### Discussion
The framework invokes this callback when `isCameraAssistanceEnabled` is `true` to notify the app of the current convergence state and user-coaching recommendations.
```
--------------------------------
### Accessing the distance property
Source: https://developer.apple.com/documentation/nearbyinteraction/ninearbyobject/distance-9atp7
Read the distance property to get the distance in meters to the peer device. If the distance is unavailable, the value will be NINearbyObjectDistanceNotAvailable.
```objc
@property (nonatomic, readonly) float distance;
```
--------------------------------
### Get Discovery Method Property
Source: https://developer.apple.com/documentation/nearbyinteraction/nidltdoaconfiguration/discoverymethod-swift.enum
Access the discovery method property to determine the technology your app uses for discovering DL-TDOA anchors.
```swift
var discoveryMethod: NIDLTDOAConfiguration.DiscoveryMethod
```
--------------------------------
### init(networkIdentifier:discoveryMethod:)
Source: https://developer.apple.com/documentation/nearbyinteraction/nidltdoaconfiguration/init%28networkidentifier%3Adiscoverymethod%3A%29
Initializes a DL-TDOA configuration with a network identifier for a specific tracked area and the method used to discover anchors.
```APIDOC
## init(networkIdentifier:discoveryMethod:)
### Description
Initializes a DL-TDOA configuration with a network identifier and discovery method.
### Parameters
`networkIdentifier` (Int) - An ID that distinguishes among multiple tracked areas if there’s more than one tracked area in the vicinity.
`discoveryMethod` (NIDLTDOAConfiguration.DiscoveryMethod) - The technology that the session uses to discover DL-TDOA anchors. Can be `.wifi` or `.bluetoothLowEnergy`.
### Discussion
Use this initializer to create a DL-TDOA configuration that specifies a network identifier for a specific tracked area and the method it uses to discover anchors in the tracked area. The network identifier corresponds to the session ID configured in the DL-TDOA anchors. Anchors with the same session ID belong to the same tracked area.
Specify the method your app uses to discover anchors among `NIDLTDOAConfiguration.DiscoveryMethod.wifi` and `NIDLTDOAConfiguration.DiscoveryMethod.bluetoothLowEnergy` to match the infrastructure in your deployment environment.
### Request Example
```swift
let configuration = NIDLTDOAConfiguration(
networkIdentifier: 1,
discoveryMethod: .wifi
)
session.run(configuration)
```
```
--------------------------------
### Create Nearby Peer Configuration
Source: https://developer.apple.com/documentation/nearbyinteraction/initiating-and-maintaining-a-session
Initialize a configuration object for an iPhone or Apple Watch peer using its discovery token.
```swift
let configuration = NINearbyPeerConfiguration(peerToken: peerDiscoverToken)
```
--------------------------------
### Initializer for NIDLTDOAMeasurementType
Source: https://developer.apple.com/documentation/nearbyinteraction/nidltdoameasurementtype/init%28rawvalue%3A%29
Creates a measurement type from the given underlying value. Available on iOS, iPadOS, and Mac Catalyst starting from version 26.0.
```APIDOC
## init(rawValue:)
### Description
Creates a measurement type from the given underlying value.
### Parameters
#### Path Parameters
- **rawValue** (Int) - Description of the raw value parameter.
```
--------------------------------
### Get activeSessionsLimitExceeded Error Code
Source: https://developer.apple.com/documentation/nearbyinteraction/nierror/activesessionslimitexceeded
Access the `activeSessionsLimitExceeded` error code. This indicates the app has reached its limit for concurrent Nearby Interaction sessions.
```swift
static var activeSessionsLimitExceeded: NIError.Code { get }
```
--------------------------------
### NINearbyAccessoryConfiguration Initializers
Source: https://developer.apple.com/documentation/nearbyinteraction/ninearbyaccessoryconfiguration
Initializes a configuration for a nearby accessory. The method used depends on the accessory's technology (UWB or Bluetooth Channel Sounding).
```APIDOC
## Initializers
### `init(data:)`
Initializes a configuration with data received from a UWB accessory.
### `init(bluetoothChannelSoundingIdentifier:previousBluetoothIdentifier:)`
Initializes a configuration using the Bluetooth pairing identifier for Bluetooth Channel Sounding accessories.
### `init(accessoryData:bluetoothPeerIdentifier:)`
Initializes a configuration for background interaction with Bluetooth accessories, passing the accessory's Bluetooth identifier.
```
--------------------------------
### Get and Set Network Identifier
Source: https://developer.apple.com/documentation/nearbyinteraction/nidltdoaconfiguration/networkidentifier
Access the unique identifier for a Downlink Time-Difference-of-Arrival network. Set this to the session ID from the anchor's configuration.
```swift
var networkIdentifier: Int { get set }
```
--------------------------------
### init(networkIdentifier:)
Source: https://developer.apple.com/documentation/nearbyinteraction/nidltdoaconfiguration/init%28networkidentifier%3A%29
Initializes a Downlink Time-Difference-of-Arrival (DL-TDOA) configuration for a specific tracked area. The `discoveryMethod` defaults to `NIDLTDOAConfiguration.DiscoveryMethod.bluetoothLowEnergy`.
```APIDOC
## init(networkIdentifier:)
### Description
Initializes a Downlink Time-Difference-of-Arrival (DL-TDOA) configuration for a specific tracked area.
### Parameters
#### Path Parameters
* **networkIdentifier** (Int) - Required - An identifier for the DL-TDOA network that the session belongs to. Anchors that share the same network ID are part of one ranging network that can span multiple anchor clusters.
### Discussion
When you call this method, the `discoveryMethod` defaults to `NIDLTDOAConfiguration.DiscoveryMethod.bluetoothLowEnergy`. To initialize a configuration and specify your deployment’s discovery method, call `init(networkIdentifier:discoveryMethod:)` instead.
### See Also
* `init(networkIdentifier:discoveryMethod:)`
```
--------------------------------
### NIDLTDOAMeasurementType.response
Source: https://developer.apple.com/documentation/nearbyinteraction/nidltdoameasurementtype/response
A type that indicates the measurement derives from responder anchors’ messages. Available on iOS, iPadOS, and Mac Catalyst starting from version 26.0.
```APIDOC
## NIDLTDOAMeasurementType.response
### Description
A type that indicates the measurement derives from responder anchors’ messages.
### Availability
iOS 26.0+, iPadOS 26.0+, Mac Catalyst 26.0+
### Code Example
```swift
case response
```
```
--------------------------------
### Initialize NINearbyAccessoryConfiguration
Source: https://developer.apple.com/documentation/nearbyinteraction/ninearbyaccessoryconfiguration/init%28bluetoothchannelsoundingidentifier%3Apreviousbluetoothidentifier%3A%29
Use this initializer to create an accessory configuration that implements Bluetooth Channel Sounding. Provide the previous Bluetooth identifier for reconnection scenarios.
```swift
init(
bluetoothChannelSoundingIdentifier bluetoothIdentifier: UUID,
previousBluetoothIdentifier: UUID?
)
```
```swift
// Initial connection.
let config = NINearbyAccessoryConfiguration(
bluetoothChannelSoundingIdentifier: btcsIdentifier,
previousBluetoothIdentifier: nil
)
session.run(config)
```
```swift
// Reconnection with a new identifier.
let reconnectConfig = NINearbyAccessoryConfiguration(
bluetoothChannelSoundingIdentifier: newBtcsIdentifier,
previousBluetoothIdentifier: previousBtcsIdentifier
)
session.run(reconnectConfig)
```
--------------------------------
### supportsDLTDOAMeasurement
Source: https://developer.apple.com/documentation/nearbyinteraction/nidevicecapability/supportsdltdoameasurement
A property that indicates if the device supports Downlink Time-Difference-of-Arrival ranging. This property is available on iOS, iPadOS, and Mac Catalyst starting from version 26.0.
```APIDOC
## Instance Property
# supportsDLTDOAMeasurement
A property that indicates if the device supports Downlink Time-Difference-of-Arrival ranging.
iOS 26.0+
iPadOS 26.0+
Mac Catalyst 26.0+
```swift
var supportsDLTDOAMeasurement: Bool { get }
```
**Required**
## Discussion
Only create a `NIDLTDOAConfiguration` instance if the value of this property is `true`.
```
--------------------------------
### init(coder:)
Source: https://developer.apple.com/documentation/nearbyinteraction/nidltdoameasurement/init%28coder%3A%29
Initializes an object from the NSCoder. This is a standard initializer for objects that support decoding.
```APIDOC
## init?(coder: NSCoder)
### Description
Initializes an object from an `NSCoder`. This initializer is typically used when deserializing objects, often in conjunction with `NSKeyedArchiver` and `NSKeyedUnarchiver`.
### Method
`init?(coder: NSCoder)`
### Parameters
#### Path Parameters
None
#### Query Parameters
None
#### Request Body
None
### Request Example
None
### Response
#### Success Response (Initializer)
An instance of the object, or `nil` if initialization fails.
#### Response Example
None
```
--------------------------------
### Get resourceUsageTimeout Error Code
Source: https://developer.apple.com/documentation/nearbyinteraction/nierror/resourceusagetimeout
Access the static property to retrieve the resourceUsageTimeout error code. This indicates a session timeout due to resource conservation.
```swift
static var resourceUsageTimeout: NIError.Code { get }
```
--------------------------------
### sessionFailed Error Code
Source: https://developer.apple.com/documentation/nearbyinteraction/nierror/sessionfailed
Use this static property to check if a Nearby Interaction session has failed. If it has, you must start a new session to continue interacting with the peer.
```swift
static var sessionFailed: NIError.Code { get }
```
--------------------------------
### Declare NIDiscoveryToken Class
Source: https://developer.apple.com/documentation/nearbyinteraction/nidiscoverytoken
This snippet shows the basic declaration of the NIDiscoveryToken class. It is available on iOS, iPadOS, Mac Catalyst, and watchOS starting from specific versions.
```swift
class NIDiscoveryToken
```
--------------------------------
### NINearbyAccessoryConfiguration Properties and Methods
Source: https://developer.apple.com/documentation/nearbyinteraction/ninearbyaccessoryconfiguration
Configuration options and methods for NINearbyAccessoryConfiguration, including enabling camera assistance for precision finding.
```APIDOC
## Properties and Methods
### `isCameraAssistanceEnabled` (Boolean)
Enables or disables camera assistance for Precision Finding. Set to `true` to combine UWB with ARKit for locating stationary objects.
### `setARSession(_:)`
Sets an ARSession instance to be used with camera assistance for enhanced precision finding.
```
--------------------------------
### Initializer
Source: https://developer.apple.com/documentation/nearbyinteraction/nidltdoaconfiguration/discoverymethod-swift.enum/init%28rawvalue%3A%29
Initializes a discovery method from a raw value. Available on iOS 27.0+, iPadOS 27.0+, and Mac Catalyst 27.0+.
```APIDOC
## init(rawValue:)
### Description
Initializes a discovery method from a raw value.
### Parameters
#### Raw Value
- `rawValue` (Int) - The raw integer value of the discovery method.
```
--------------------------------
### Request Location Authorization for DL-TDOA
Source: https://developer.apple.com/documentation/nearbyinteraction/dl-tdoa-ranging
Before starting a DL-TDOA session, request location authorization using CLLocationManager. Ensure your app's Info.plist includes NSLocationWhenInUseUsageDescription or NSLocationAlwaysAndWhenInUseUsageDescription.
```swift
func startDLTDOA() {
// Request location authorization.
// The system prompts the person if authorization status is not determined.
locationManager.requestWhenInUseAuthorization()
// Check authorization status.
let authStatus = locationManager.authorizationStatus
guard authStatus == .authorizedWhenInUse || authStatus == .authorizedAlways else {
print("Location authorization required for DL-TDOA.")
return
}
// Configure the DL-TDOA session.
}
```
--------------------------------
### Initialize DL-TDOA Configuration
Source: https://developer.apple.com/documentation/nearbyinteraction/nidltdoaconfiguration/init%28networkidentifier%3A%29
Initializes a DL-TDOA configuration with a network identifier. The `discoveryMethod` defaults to `.bluetoothLowEnergy`. Use `init(networkIdentifier:discoveryMethod:)` to specify a different discovery method.
```swift
init(networkIdentifier: Int)
```
--------------------------------
### init(accessoryData:bluetoothPeerIdentifier:)
Source: https://developer.apple.com/documentation/nearbyinteraction/ninearbyaccessoryconfiguration/init%28accessorydata%3Abluetoothpeeridentifier%3A%29
Creates a configuration for an accessory with the given Bluetooth peer identifier. This initializer is used when your app interacts with a Bluetooth accessory that's paired to the device to enable interaction while your app is in the background.
```APIDOC
## init(accessoryData:bluetoothPeerIdentifier:)
### Description
Creates a configuration for an accessory with the given Bluetooth peer identifier.
### Parameters
#### Parameters
- **accessoryData** (Data) - The accessory’s configuration data formatted to the Ultra Wideband (UWB) third-party device specification.
- **identifier** (UUID) - The accessory’s Bluetooth peer identifier. For more information, see `CBPeer` `identifier`.
### Discussion
Use this initializer when your app interacts with a Bluetooth accessory that’s paired to the device to enable interaction while your app is in the background.
```
--------------------------------
### Get Coordinates Type
Source: https://developer.apple.com/documentation/nearbyinteraction/nidltdoameasurement/coordinatestype
Retrieves the type of coordinate system the measurement conforms to. This property is read-only and available on iOS 26.0+, iPadOS 26.0+, and Mac Catalyst 26.0+.
```swift
var coordinatesType: NIDLTDOACoordinatesType { get }
```
--------------------------------
### Get Localized Description of Error
Source: https://developer.apple.com/documentation/nearbyinteraction/nialgorithmconvergencestatus-2fnve/reason/localizeddescription
Access the localizedDescription property to retrieve a string that describes the error. Available on iOS 16.0+, iPadOS 16.0+, macOS, and watchOS 9.0+.
```swift
var localizedDescription: String? { get }
```
--------------------------------
### Initializer
Source: https://developer.apple.com/documentation/nearbyinteraction/nimotionactivitystate/init%28rawvalue%3A%29
Creates a motion state with the specified underlying value. Available on iOS 15.0+, iPadOS 15.0+, and Mac Catalyst 15.0+.
```APIDOC
## init(rawValue:)
### Description
Creates a motion state with the specified underlying value.
### Parameters
#### Path Parameters
- **rawValue** (Int) - Description of the raw value parameter is not provided in the source.
### Method Signature
```swift
init?(rawValue: Int)
```
```
--------------------------------
### Initialize with Bluetooth Channel Sounding Identifier
Source: https://developer.apple.com/documentation/nearbyinteraction/ninearbyaccessoryconfiguration
Initializes a configuration for Bluetooth Channel Sounding accessories. Use the Bluetooth pairing identifier for iOS 27 and later.
```swift
init(bluetoothChannelSoundingIdentifier:previousBluetoothIdentifier:)
```
--------------------------------
### NINearbyObject.VerticalDirectionEstimate.above
Source: https://developer.apple.com/documentation/nearbyinteraction/ninearbyobject/verticaldirectionestimate-swift.enum/above
Represents the case where the nearby object is vertically above the user's device. This is available on iOS, iPadOS, Mac Catalyst, and watchOS starting from version 16.0 (or 9.0 for watchOS).
```APIDOC
## NINearbyObject.VerticalDirectionEstimate.above
### Description
An indication that the nearby object resides at a higher vertical location than the user’s device.
### Platforms
iOS 16.0+
iPadOS 16.0+
Mac Catalyst 16.0+
watchOS 9.0+
### Case
```swift
case above
```
```
--------------------------------
### session(_:didUpdateAlgorithmConvergence:for:)
Source: https://developer.apple.com/documentation/nearbyinteraction/nisessiondelegate/session%28_%3Adidupdatealgorithmconvergence%3Afor%3A%29
This method is called when Camera Assistance is enabled to notify the app of the current convergence state and user-coaching recommendations. It's part of the `NISessionDelegate` protocol.
```swift
optional func session(
_ session: NISession,
didUpdateAlgorithmConvergence convergence: NIAlgorithmConvergence,
for object: NINearbyObject?
)
```
--------------------------------
### Initializer
Source: https://developer.apple.com/documentation/nearbyinteraction/niconfiguration/init%28coder%3A%29
Initializes an instance of NIConfiguration from an decoder. Available on iOS 14.0+, iPadOS 14.0+, Mac Catalyst 14.0+, and watchOS 7.3+.
```APIDOC
## Initializer
### Description
Initializes an instance of `NIConfiguration` from an decoder.
### Availability
iOS 14.0+
iPadOS 14.0+
Mac Catalyst 14.0+
watchOS 7.3+
### Signature
```swift
init?(coder: NSCoder)
```
```
--------------------------------
### Cluster Initiator Address Property
Source: https://developer.apple.com/documentation/nearbyinteraction/nidltdoameasurement/clusterinitiatoraddress
This property represents the address of the initiator anchor within the same cluster. It is available in iOS, iPadOS, and Mac Catalyst starting from version 27.0 (Beta).
```swift
var clusterInitiatorAddress: Int { get }
```
--------------------------------
### Check Platform Support with isSupported
Source: https://developer.apple.com/documentation/nearbyinteraction/nierror/code/unsupportedplatform
Before initiating an interaction session, it is recommended to call the `isSupported` method to verify that the Nearby Interaction framework is compatible with the device's platform. This helps prevent `unsupportedPlatform` errors.
```swift
case unsupportedPlatform
```
--------------------------------
### NIError.Code.sessionFailed Case
Source: https://developer.apple.com/documentation/nearbyinteraction/nierror/code/sessionfailed
Use this error code to identify when a Nearby Interaction session has failed. To continue interacting with a peer after a session failure, your app must start a new session.
```swift
case sessionFailed
```
--------------------------------
### NIAlgorithmConvergence
Source: https://developer.apple.com/documentation/nearbyinteraction/nialgorithmconvergence
Represents the current state of the framework’s Camera Assistance feature and provides reasons for user coaching recommendations.
```APIDOC
## Class NIAlgorithmConvergence
An object that provides the state and reason for user coaching recommendations.
### Overview
This class conveys the current state of the framework’s Camera Assistance feature when you turn on `isCameraAssistanceEnabled`. When the status indicates that user action is required to achieve the highest-quality results, instances of this class identify specific actions the user can do to help. To improve the status, the app needs to coach the user such as by presenting instructional text. The information you provide tells the user, for example, where and at what speed to pan the device around the environment.
To listen for the convergence status, implement `session(_:didUpdateAlgorithmConvergence:for:)`.
### Topics
#### Determining convergence state
`var status: NIAlgorithmConvergenceStatus`
The current state of the framework’s Camera Assistance feature.
### Initializers
`init?(coder: NSCoder)`
### Relationships
#### Inherits From
* `NSObject`
#### Conforms To
* `CVarArg`
* `CustomDebugStringConvertible`
* `CustomStringConvertible`
* `Equatable`
* `Hashable`
* `NSCoding`
* `NSCopying`
* `NSObjectProtocol`
* `NSSecureCoding`
```
--------------------------------
### NIAlgorithmConvergenceStatusReason Type Alias
Source: https://developer.apple.com/documentation/nearbyinteraction/nialgorithmconvergencestatusreason
Defines the type for reasons related to the Camera Assistance convergence status. Use these reasons to guide user actions when Camera Assistance requires intervention.
```objc
typedef NSString * NIAlgorithmConvergenceStatusReason;
```
--------------------------------
### init(coder:)
Source: https://developer.apple.com/documentation/nearbyinteraction/nialgorithmconvergence/init%28coder%3A%29
Initializes an instance of NIAlgorithmConvergence from decoded data. This initializer is part of the NSCoding protocol and is used for deserialization.
```APIDOC
## init(coder:)
### Description
Initializes an instance of NIAlgorithmConvergence from decoded data. This initializer is part of the NSCoding protocol and is used for deserialization.
### Availability
iOS 16.0+
iPadOS 16.0+
Mac Catalyst 16.0+
watchOS 9.0+
### Signature
```swift
init?(coder: NSCoder)
```
```
--------------------------------
### Get Nearby Interaction Error Domain
Source: https://developer.apple.com/documentation/nearbyinteraction/nierror/errordomain
Access the static `errorDomain` property to retrieve the string identifier for errors originating from the Nearby Interaction framework. This is useful for error handling and logging.
```swift
static var errorDomain: String { get }
```
--------------------------------
### NIError.Code.invalidARConfiguration Case
Source: https://developer.apple.com/documentation/nearbyinteraction/nierror/code/invalidarconfiguration
Use this error code when the framework is unable to start Camera Assistance. This can happen if the device does not support Camera Assistance or if the app's AR session does not meet the required criteria.
```swift
case invalidARConfiguration
```
--------------------------------
### Session Did Update Algorithm Convergence
Source: https://developer.apple.com/documentation/nearbyinteraction/nisessiondelegate
Provides recommended actions for the user to improve Camera Assistance during a Nearby Interaction session.
```swift
func session(_ session: NISession, didUpdate algorithmConvergence: NIAlgorithmConvergence, for nearbyObject: NINearbyObject?)
```
--------------------------------
### activeExtendedDistanceSessionsLimitExceeded
Source: https://developer.apple.com/documentation/nearbyinteraction/nierror/activeextendeddistancesessionslimitexceeded
This error code indicates that the device has exceeded the maximum number of active extended distance sessions allowed. It is available on iOS, iPadOS, Mac Catalyst, and watchOS starting from version 17.0.
```APIDOC
## activeExtendedDistanceSessionsLimitExceeded
### Description
An error code that indicates that the device exceeds the available number of active extended distance sessions.
### Availability
iOS 17.0+ iPadOS 17.0+ Mac Catalyst 17.0+ watchOS 10.0+
### Declaration
```swift
static var activeExtendedDistanceSessionsLimitExceeded: NIError.Code { get }
```
```
--------------------------------
### Ensuring feature support
Source: https://developer.apple.com/documentation/nearbyinteraction/nisession
Provides information about the device's supported framework features for interaction sessions.
```APIDOC
## Ensuring feature support
`class var deviceCapabilities: any NIDeviceCapability`
An object that communicates the device’s supported framework features.
`protocol NIDeviceCapability`
An interface that adds Boolean values that indicate an interaction session feature support.
```
--------------------------------
### session(_:didUpdateDLTDOA:)
Source: https://developer.apple.com/documentation/nearbyinteraction/nisessiondelegate/session%28_%3Adidupdatedltdoa%3A%29
The framework invokes this callback to provide measurements for sessions that run NIDLTDOAConfiguration.
```APIDOC
## session(_:didUpdateDLTDOA:)
### Description
Provides device ranging estimates for a Downlink Time-Difference-of-Arrival session.
### Method
`optional func session(_ session: NISession, didUpdateDLTDOA measurements: [NIDLTDOAMeasurement])`
### Parameters
#### Path Parameters
- None
#### Query Parameters
- None
#### Request Body
- None
### Request Example
- None
### Response
#### Success Response (200)
- None
#### Response Example
- None
### Parameters
- **session** (NISession) - The session that provides a Downlink Time-Difference-of-Arrival measurement.
- **measurements** ([NIDLTDOAMeasurement]) - The measurement updates for the session.
```
--------------------------------
### Initialize Discovery Method from Raw Value
Source: https://developer.apple.com/documentation/nearbyinteraction/nidltdoaconfiguration/discoverymethod-swift.enum/init%28rawvalue%3A%29
Use this initializer to create a `DiscoveryMethod` instance by providing its raw integer value. This is useful when decoding data or converting from an integer representation.
```swift
init?(rawValue: Int)
```
--------------------------------
### discoveryToken
Source: https://developer.apple.com/documentation/nearbyinteraction/nisession/discoverytoken
A temporary, random identifier for a device. This property is set by NI when an app initializes a session and is unique to that session, identifying the device that created it. To start a session, an app shares this object with a nearby peer.
```APIDOC
## discoveryToken
A temporary, random identifier for a device.
### Description
NI sets this property when an app initializes a session. The value of `discoveryToken` is unique to the session and identifies the device that created the session.
To begin a session, an app shares this object with a nearby peer using a network technology that both devices agree to. For an example that shares discovery tokens using Multipeer Connectivity, see Implementing interactions between users in close proximity.
### Declaration
```swift
@NSCopying
var discoveryToken: NIDiscoveryToken? { get }
```
### Availability
iOS 14.0+ iPadOS 14.0+ Mac Catalyst 14.0+ watchOS 7.3+
```
--------------------------------
### NIAlgorithmConvergenceStatus.notConverged(_:)
Source: https://developer.apple.com/documentation/nearbyinteraction/nialgorithmconvergencestatus-2fnve/notconverged%28_%3A%29
Use this case when the Camera Assistance feature requires user action to become operational. The `reason` parameter provides specific guidance on the action needed.
```swift
case notConverged([NIAlgorithmConvergenceStatus.Reason])
```
--------------------------------
### Initializer for NINearbyAccessoryConfiguration
Source: https://developer.apple.com/documentation/nearbyinteraction/ninearbyaccessoryconfiguration/init%28accessorydata%3Abluetoothpeeridentifier%3A%29
Use this initializer to create a configuration for an accessory with the given Bluetooth peer identifier. This is useful for background interactions with paired Bluetooth accessories.
```swift
init(
accessoryData: Data,
bluetoothPeerIdentifier identifier: UUID
) throws
```
--------------------------------
### Get Anchor Floor Number - Swift
Source: https://developer.apple.com/documentation/nearbyinteraction/nidltdoameasurement/floorelevation-swift.class/floornumber
Access the floor number where the DL-TDOA anchor is located. Negative values indicate floors below ground level. Use this with the `height` property for precise vertical positioning.
```swift
var floorNumber: Int { get }
```
--------------------------------
### NIDLTDOAConfiguration Initializer Signature
Source: https://developer.apple.com/documentation/nearbyinteraction/nidltdoaconfiguration/init%28networkidentifier%3Adiscoverymethod%3A%29
This is the signature for the initializer that sets up a DL-TDOA configuration with a network identifier and discovery method.
```swift
init(
networkIdentifier: Int,
discoveryMethod: NIDLTDOAConfiguration.DiscoveryMethod
)
```
--------------------------------
### Get Direction Vector
Source: https://developer.apple.com/documentation/nearbyinteraction/ninearbyobject/direction-4qh5w
Retrieve the direction vector pointing from the user's device to the peer device. This property is nil when direction is unavailable. On iPhone, it can provide direction for third-party accessories when camera assistance is enabled.
```swift
var direction: simd_float3? { get }
```
--------------------------------
### Check Convergence Status Reasons
Source: https://developer.apple.com/documentation/nearbyinteraction/nialgorithmconvergencestatus-2fnve/reason
When Camera Assistance requires user intervention, check the convergence status and coach the user based on the provided reasons.
```swift
static let insufficientMovement: NIAlgorithmConvergenceStatus.Reason
```
```swift
static let insufficientHorizontalSweep: NIAlgorithmConvergenceStatus.Reason
```
```swift
static let insufficientVerticalSweep: NIAlgorithmConvergenceStatus.Reason
```
```swift
static let insufficientLighting: NIAlgorithmConvergenceStatus.Reason
```
```swift
static let insufficientSignalStrength: NIAlgorithmConvergenceStatus.Reason
```
--------------------------------
### Connecting to a peer device
Source: https://developer.apple.com/documentation/nearbyinteraction/nisession
Methods and properties for discovering and connecting to a peer device.
```APIDOC
## Connecting to a peer device
`var discoveryToken: NIDiscoveryToken?`
A temporary, random identifier for a device.
`class NIDiscoveryToken`
An object that uniquely identifies a peer that participates in an interaction session.
`func run(NIConfiguration)`
Starts a session with a nearby peer.
`var configuration: NIConfiguration?`
The configuration run by the session.
`var delegateQueue: dispatch_queue_t?`
The dispatch queue on which the session invokes delegate callbacks.
```
--------------------------------
### Get World Transform for Nearby Object
Source: https://developer.apple.com/documentation/nearbyinteraction/nisession/worldtransform%28for%3A%29
Use this method to obtain a world transform for a NINearbyObject, enabling its integration into an AR experience. The transform is provided in ARKit's coordinate space. Returns `nil` if the transform is not available.
```swift
func worldTransform(for object: NINearbyObject) -> simd_float4x4?
```
--------------------------------
### Handle Nearby Object Updates
Source: https://developer.apple.com/documentation/nearbyinteraction/nisessiondelegate/session%28_%3Adidupdate%3A%29
Implement this callback to receive new nearby object updates. Handle cases where peer tokens are missing or peers are out of range. This example demonstrates checking for peer token validity and retrieving distance, angle, and direction if available.
```swift
func session(_ session: NISession, didUpdate nearbyObjects: [NINearbyObject]) {
// Ensure there's a current peer token.
guard let peerToken = peerDiscoveryToken else {
fatalError("don't have peer token")
}
// Find the right peer from session update.
guard let peerObj = nearbyObjects.first (where: { $0.discoveryToken == peerToken }) else {
return
}
// Retrieve the peer's distance, in meters.
if let distance = peerObj.distance {
// Compute peer object's distance.
}
// Retrieve the peer's horizontal angle, in radians.
if let horizontalAngle = peerObj.horizontalAngle {
// Compute peer object's angle.
}
// Retrieve the peer's direction, in `simd_float3`.
if let direction = peerObj.direction {
// Compute peer object's direction.
}
}
```
--------------------------------
### session(_:didGenerateShareableConfigurationData:for:)
Source: https://developer.apple.com/documentation/nearbyinteraction/nisessiondelegate/session%28_%3Adidgenerateshareableconfigurationdata%3Afor%3A%29
This optional delegate method provides configuration data that can be shared with a third-party accessory to initiate a Nearby Interaction session. It is called only for sessions configured for accessory interaction.
```APIDOC
## session(_:didGenerateShareableConfigurationData:for:)
### Description
Provides configuration data to share with a third-party accessory.
### Signature
```swift
optional func session(
_ session: NISession,
didGenerateShareableConfigurationData shareableConfigurationData: Data,
for object: NINearbyObject
)
```
### Parameters
#### Parameters
- **session** (*NISession*) - The session that produced the configuration data.
- **shareableConfigurationData** (*Data*) - The data to share with the accessory.
- **object** (*NINearbyObject*) - A representation of the accessory as an `NINearbyObject`.
### Discussion
The system invokes this callback only for sessions that run an accessory configuration. The `shareableConfigurationData` argument contains information that the accessory needs to begin the session. For more information, see `NINearbyAccessoryConfiguration`.
```
--------------------------------
### session(_:didUpdateDLTDOA:)
Source: https://developer.apple.com/documentation/nearbyinteraction/nisessiondelegate/session%28_%3Adidupdatedltdoa%3A%29
The framework invokes this callback to provide measurements for sessions that run `NIDLTDOAConfiguration`. This method receives an array of `NIDLTDOAMeasurement` objects.
```swift
optional func session(
_ session: NISession,
didUpdateDLTDOA measurements: [NIDLTDOAMeasurement]
)
```
--------------------------------
### Provide AR Session for Camera Assistance
Source: https://developer.apple.com/documentation/nearbyinteraction/nisession
Provides the Nearby Interaction framework with an existing AR session to use for Camera Assistance features. This is useful for integrating nearby object data into AR experiences.
```swift
func setARSession(ARSession)
```
--------------------------------
### NIAlgorithmConvergenceStatusReasonDescription Function
Source: https://developer.apple.com/documentation/nearbyinteraction/nialgorithmconvergencestatusreasondescription
This function takes an `NIAlgorithmConvergenceStatusReason` as input and returns its corresponding human-readable description string. This is useful for debugging or providing user-facing feedback about the convergence status.
```APIDOC
## NIAlgorithmConvergenceStatusReasonDescription
### Description
A human-readable description for a particular convergence status reason.
### Function Signature
```
extern NSString *NIAlgorithmConvergenceStatusReasonDescription(NIAlgorithmConvergenceStatusReason const reason);
```
### Parameters
- **reason** (`NIAlgorithmConvergenceStatusReason` const) - The convergence status reason to describe.
```
--------------------------------
### NIAlgorithmConvergenceStatus
Source: https://developer.apple.com/documentation/nearbyinteraction/nialgorithmconvergence/status-j61c
The current state of the framework’s Camera Assistance feature.
```APIDOC
## status
### Description
The current state of the framework’s Camera Assistance feature.
### Availability
iOS 16.0+ iPadOS 16.0+ Mac Catalyst 16.0+ watchOS 9.0+
### Property
```objc
@property (nonatomic, readonly) NIAlgorithmConvergenceStatus status;
```
```
--------------------------------
### Optional session(_:didGenerateShareableConfigurationData:for:)
Source: https://developer.apple.com/documentation/nearbyinteraction/nisessiondelegate/session%28_%3Adidgenerateshareableconfigurationdata%3Afor%3A%29
Implement this method to receive shareable configuration data for accessory sessions. The system invokes this callback only for sessions running an accessory configuration.
```swift
optional func session(
_ session: NISession,
didGenerateShareableConfigurationData shareableConfigurationData: Data,
for object: NINearbyObject
)
```
--------------------------------
### Interpreting Convergence Status Reasons
Source: https://developer.apple.com/documentation/nearbyinteraction/nialgorithmconvergencestatus-2fnve/reason/insufficientsignalstrength
These static properties indicate different reasons for the Nearby Interaction algorithm's convergence status. Use them to provide user guidance for resolving issues.
```swift
static let insufficientMovement: NIAlgorithmConvergenceStatus.Reason
```
```swift
static let insufficientHorizontalSweep: NIAlgorithmConvergenceStatus.Reason
```
```swift
static let insufficientVerticalSweep: NIAlgorithmConvergenceStatus.Reason
```
```swift
static let insufficientLighting: NIAlgorithmConvergenceStatus.Reason
```
--------------------------------
### Utilizing Camera Assistance
Source: https://developer.apple.com/documentation/nearbyinteraction/nisession
Provides methods for integrating nearby objects into an AR experience using Camera Assistance.
```APIDOC
## Utilizing Camera Assistance
`func setARSession(ARSession)`
Provides the framework with an existing AR session to use for Camera Assistance.
`func worldTransform(for: NINearbyObject) -> simd_float4x4?`
Returns a world transform to integrate a nearby object in an AR experience.
```
--------------------------------
### init(coder:)
Source: https://developer.apple.com/documentation/nearbyinteraction/nidiscoverytoken/init%28coder%3A%29
Initializes a new instance of NIDiscoveryToken by decoding data from an NSCoder. This initializer is available on iOS 14.0+, iPadOS 14.0+, Mac Catalyst 14.0+, and watchOS 7.3+.
```APIDOC
## init(coder:)
### Description
Initializes a new instance of NIDiscoveryToken by decoding data from an NSCoder.
### Availability
iOS 14.0+ iPadOS 14.0+ Mac Catalyst 14.0+ watchOS 7.3+
### Signature
```swift
init?(coder: NSCoder)
```
```