Creates a haptic engine from an audio session.
- iOS 13.0+
- Mac Catalyst 13.0+
- Core Haptics
An error that contains information about failed engine creation, or
nilif no error occurred.
Create your haptic engine with this initializer if you want the audio behavior of your engine to match other audio APIs in your app. For example, if you're using AVAudioSession to manage audio elsewhere in your app, then you want to share the session's
shared. In this case, the engine will mute and route audio in accordance with the passed session.
Otherwise, if you don’t pass it a session, it won’t behave the same way as elsewhere in app; audio will behave like UIKit, without syncing to a specific session. You should pass
nil when you need the engine only for playing haptics.