Contents

run(_:)

Starts a session with a nearby peer.

Declaration

func run(_ configuration: NIConfiguration)

Parameters

  • configuration:

    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.

Restart an Interaction Session

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(_:).

Prompt for User Approval

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. For more information, see Initiating and maintaining a session.

See Also

Connecting to A Peer Device