I've created a control centre widget modelled on the talk in "Extend your app's controls across the system".
In the talk, the user can select which timer they want to start ("work" or "violin").
The specific timer is passed to ToggleTimerIntent as follows:
ControlWidgetToggle(
timerState.timer.name,
isOn: timerState.isRunning
action: ToggleTimerIntent(timer: timerState.timer)
) { isOn in
...
}
However, I can't find a way to access the timer value from inside my ToggleTimerIntent, since this code isn't provided in the talk.
An AppIntent must provide an empty init(), so I've specified timer as an option String:
@available(iOS 18, *)
struct ToggleTimerIntent: SetValueIntent {
static let title: LocalizedStringResource = "Toggle Timer"
// This value isn't never populated.
var timer: String?
@Parameter(title: "Running")
var value: Bool
func perform() async throws -> some IntentResult {
if let timer {
}
else {
// Always here
}
}
}
When I backtrace the code, ToggleTimerIntent is instantiated several times, however perform() is only called on an instance where the timer value isn't provided.
Post
Replies
Boosts
Views
Activity
Hi, I'm integrating wind down into my app, Streaks.
For tasks like brushing of teeth or taking medication, what is the recommended category?
Best candidates:
sleepMindfulness
sleepPrepareForTomorrow
sleepYogaAndStretching
Brushing teeth is a physical activity, and to some degree it relates to mindfulness, but on first glance it seems like another type such as .sleepHealth or .sleepPreparation would be useful.
The other 4 are obviously not related at all:
sleepJournaling
sleepMusic
sleepPodcasts
sleepReading
Thanks!
Quentin
Hi,
I've just enabled the "Runs as Current User" checkbox (I already had the "User Management > Get Current User" option checked.
Automatic signing for development fails when "Runs as Current User" is checked. Additionally, I don't see any additional options in the "Certifications, Identifiers and Profiles" section of the Developer Portal in order to sign manually.
I'm attemping to use UIDocumentPickerViewController, but when I run the app in development, I get an entitlements error:[OpenSavePanels] ERROR: Unable to display save panel: your app is missing the User Selected File Read/Write app sandbox entitlement. Please ensure that your app's target capabilities include the proper entitlements.My entitlements do incldue "User Selected File: Read/Write" in the App Sandbox section.I'm using "Automatically manage signing" and I tried clearing out all provisioning profiles, but this doesn't seem to help.
I'm unable to get custom fonts to work in my Mac Catalyst app.In iOS, you specify the font filenames with the UIAppFonts array key in Info.plist.On Mac, you need to specify the ATSApplicationFontsPath key in Info.plist. This is the path relative to Resources that all custom fonts live in.However in Catalyst, neither of these solutions appear to work.