StartDiveIntent
An App Intent that lets people start a dive session when they press the Action button on Apple Watch Ultra.
Declaration
protocol StartDiveIntent : SystemIntentMentioned in
Overview
To implement the start dive action, create a structure that adopts the StartDiveIntent protocol.
struct MyStartDiveIntent: StartDiveIntent {
static var title: LocalizedStringResource = "Starting a dive session."
func perform() async throws -> some IntentResult {
logger.debug("*** Starting a dive session. ***")
await DiveManager.shared.start()
return .result(actionButtonIntent: StartDive())
}
}This intent needs a title property that provides a localized description of the action, and a perform() method, which the system calls when it triggers the intent.
To read live depth, water pressure, and water temperature data, see Accessing submersion data.
For more information, see Responding to the Action button on Apple Watch Ultra.