Post

Replies

Boosts

Views

Activity

Reply to FocusFilterIntent react to FocusMode deactivating
I've found the issue. The FocusFilterIntent was only called once, since I've had Parameters inside that were not optional. It seems like it isn't able to infer the parameters that are non optional when deactivating the Focus Mode. So simply marking the Parameters as optional solves this problem. struct FocusFilterIntent: SetFocusFilterIntent { static let title: LocalizedStringResource = "Some Title" static let description: LocalizedStringResource = """ Some Description """ var displayRepresentation: DisplayRepresentation { DisplayRepresentation(title: "App", subtitle: "Subtitle") } @Parameter(title: "Param1") var param1: Param1? // turned to optional func perform() async throws -> some IntentResult { Logger.focus.info("FocusFilterIntent called") if let param1 = param1 { // do something, filter is activated } else { // filter is deactivated } return .result() }
Topic: App & System Services SubTopic: General Tags:
Feb ’25
Reply to FocusFilterIntent react to FocusMode deactivating
What I've realized is that the FocusFilterIntent usually should be called twice (on activating Focus once and on deactivating once). However, my Extension is only called when activating. Did somebody else experience similar issues?
Topic: App & System Services SubTopic: General Tags:
Replies
Boosts
Views
Activity
Nov ’24
Reply to FocusFilterIntent react to FocusMode deactivating
I've found the issue. The FocusFilterIntent was only called once, since I've had Parameters inside that were not optional. It seems like it isn't able to infer the parameters that are non optional when deactivating the Focus Mode. So simply marking the Parameters as optional solves this problem. struct FocusFilterIntent: SetFocusFilterIntent { static let title: LocalizedStringResource = "Some Title" static let description: LocalizedStringResource = """ Some Description """ var displayRepresentation: DisplayRepresentation { DisplayRepresentation(title: "App", subtitle: "Subtitle") } @Parameter(title: "Param1") var param1: Param1? // turned to optional func perform() async throws -> some IntentResult { Logger.focus.info("FocusFilterIntent called") if let param1 = param1 { // do something, filter is activated } else { // filter is deactivated } return .result() }
Topic: App & System Services SubTopic: General Tags:
Replies
Boosts
Views
Activity
Feb ’25