Code: Select all
@/available(iOS 17.0, *)
struct SimpleIntent: AppIntent {
static var title: LocalizedStringResource = "Set It"
static var description = IntentDescription("Set It")
@/Parameter(title: "Simple")
var simple: SimpleEntity?
@/Parameter(title: "Completion")
var count: Double?
init(simple: SimpleEntity? = nil, count: Double) {
self.simple = simple
self.count = count
}
init() {}
func perform() async throws -> some IntentResult {
await track()
return .result()
}
@/MainActor
private func track() async {
// Some logic to update Core Data
}
}
@/available(iOS 17.0, *)
@/available(iOSApplicationExtension, unavailable)
extension SimpleIntent: ForegroundContinuableIntent {
}