I'm currently working on a Apple Watch Ultra app that will be used for Diving purposes, The Application does not need access to the CoreMotion Water Submersion Manager but would be nice and am waiting for access. I have Successfully got the Action button to initialize and open the app within the "Dive" section of the App. However I'm trying to make it when a certain view appears that a new actionButtonIntent is applied from a donation. I've followed all the documenation I can find from the StartWorkout Intent. The examples within the documentation seem great for workout apps, but has completely disregarded the Dive portion in my opinion.
This code is executed after the view switches. (Which I have debugged and I know the init I had in here of the CustomAppIntentForActionButton was being called)
Task {
try await DivingIntent().donate(result: .result(actionButtonIntent: CustomAppIntentForActionButton()))
}
This is the DivingIntent, Start Dive Attempt struct
import Foundation
import AppIntents
struct DivingIntent: StartDiveIntent {
static var title: LocalizedStringResource = "Lets go Diving!"
@MainActor
func perform() async throws -> some IntentResult {
print("StartDiveIntent performed")
return .result()
}
}
This is the CustomAppIntentForActionButton
import Foundation
import AppIntents
struct CustomAppIntentForActionButton: AppIntent {
static var title: LocalizedStringResource = .init(stringLiteral: "Test")
@MainActor
func perform() async throws -> some IntentResult {
print("CustomAppIntentForActionButton performed")
return .result()
}
}
What am I doing wrong, I feel like I'm going crazy here.
This is the documentation and information I've read online:
https://developer.apple.com/documentation/appintents/actionbuttonarticle
https://github.com/KhaosT/WatchActionButtonExample (Does not work - Pause / Resume) - I also tried add my own Custom AppIntent within (an example of LapMark)
https://twitter.com/mgorbach/status/1567570300820144131
https://twitter.com/qzervaas/status/1568206906862497793