I show some content in LiveActivity Dynamic Island and added a button. As buttons work with App Intent I created an Intent. When the button is clicked I get the following error
Could not find an intent with identifier MyIntent, mangledTypeName: Optional("19LiveWidgetExtension10MyIntentV")
MyIntent.swift
import Foundation
import AppIntents
struct MyIntent: LiveActivityIntent {
public init() { }
func perform() async throws -> some IntentResult {
print("click")
return .result()
}
}
MyLiveActivity.swift
...
DynamicIslandExpandedRegion(.bottom) {
HStack(alignment: .top) {
Button(intent: MyIntent()) {
Image(systemName: "bolt.fill")
}
}
.tint(.white)
.padding()
}
....
The Intent is added to all targets. Any ideas?
Post
Replies
Boosts
Views
Activity
I want to make use of the dynamic island and create a fluid animation so that it pops out and shows an icon with a text, like the face id animation from iOS. How can I achieve that? Is there a library for it?
I use StoreKit's StoreView to buy in-app purchases. The purchase is working in the simulator, but how can I restore purchases? I did not find a restore handler, there is only a onInAppPurchaseCompletion but I'm missing a onRestorePurchaseCompletion or similar.
This is how it looks
This is my code:
StoreView(ids: ["my.product.id"])
.storeButton(.visible, for: .restorePurchases)
.storeButton(.hidden, for: .cancellation)
.onInAppPurchaseCompletion { product, result in
if case .success(.success(let transaction)) = result {
print("Purchased successfully: \(transaction.signedDate)")
isPremium = true
} else {
print("Something went wrong")
}
}