Just to close the loop on this: when creating a widget extension, Xcode has a template to create this timer, which it does as follows:
struct StartTimerIntent: SetValueIntent {
static let title: LocalizedStringResource = "Start a timer"
@Parameter(title: "Timer Name")
var name: String
@Parameter(title: "Timer is running")
var value: Bool
init() {}
init(_ name: String) {
self.name = name
}
func perform() async throws -> some IntentResult {
// Start the timer…
return .result()
}
}
So anyway, the timer name needs to be marked as @Parameter, and mustn't be optional.
Post
Replies
Boosts
Views
Activity
Still present in Xcode 16 Beta 1.
Your control widget just needs to extend from LiveActivityIntent, then you can use the normal controls for managing Live Activities.
struct MyControlWidget: ControlWidget, LiveActivityIntent {
func perform() {
// Activity<ActivityType>.request( ... )
}
}
I'm also seeing this issue recently and cannot figure out why. Nothing has changed from my end, and everything works as expected.
Transformable field in data model
Correct class in the Transformer field
Class is registered early in app lifecycle (in same class as Core Data container is created)
Not using Swift Data
Am using model versions in .xcdatamodel
It feels like an issue related to the analysis during build time.
I've submitted FB13311957.
I'm seeing this also occasionally but can't figure out why exactly.
I'm wondering maybe if it's something like the timeline being reloaded while device is locked, and then trying to access something like HealthKit (which is unavailable when locked).
My understanding is that the RelevantIntentManager / Smart Stack replaces the Siri Watch Face. The Siri Watch Face is effectively now deprecated, since it doesn't support suggestions that use AppIntent (only INIntents).
Having said all that: I'm having the same issue, in that no matter what I pass to RelevantIntentManager.shared.updateRelevantIntents, my widget is never automatically displayed in the Smart Stack in the same way that "Now Playing", "Stopwatch", "News" etc.. do.
I also can't find anything relevant in Console that would suggest something is going wrong. The widget can be added manually to the Smart Stack, but I want it to populate/depopulate automatically.
It appears that this isn't available, even though the "Data Sources & Access" screen for it makes it sound possible. Even just read-only access would be super useful.
It's a bit frustrating that this and the medications data hasn't been opened up to third-party developers. I understand that the medication data is structured in a completely different way to the rest of HealthKit, so there's definitely much more complexity there, but the mood tracking records appear to be simple flat records like everything else.
I've filed FB13069949 about accessing State of Mind data.
I'm experiencing the same issue using some legacy MD5 code. I get the same output whether I run the script from the command-line or as a build phase script, so I believe this also may be a bug in all of the betas.
#!/usr/bin/swift
import CryptoKit
let hash = Insecure.MD5.hash(data: ...)
I've filed FB12857119
You can't achieve both ClockKit and SwiftUI with the same method.
In ClockKit, you need to read the userInfo in handleUserActivity
In SwiftUI, you need to use .onOpenURL.
The problem I'm having though is if I use .widgetURL() in the SwiftUI view, it causes the complication to flash off/on on the watch face when the watch becomes active.
Instead of doing as the above comment, use NSPersistentCloudKitContainer.initializeCloudKitSchema() instead.
Do it on a physical device
Do it to sandbox environment
Deploy changes to production
There will likely be more changes than you're expecting if you've previously been relying on it auto-creating, but that should be fine.
After a bit of help on Twitter, here's how to get this working:
Add the shortTitle and systemImageName parameters in your AppShortcut(). If none of your shortcuts have this, the coloured panel won't appear in Shortcuts app. The system image name is from SF Symbols.
Create colours in your main app's asset catalog (e.g. ShortcutsBackground1, ShortcutsBackground2 and ShortcutsForeground
Now add NSAppIconActionTintColorName and NSAppIconComplementingColorNames in your Info.plist. This needs to go within CFBundlePrimaryIcon.
For example:
<dict>
.....
<key>CFBundleIcons</key>
<dict>
<key>CFBundlePrimaryIcon</key>
<dict>
....
<key>NSAppIconActionTintColorName</key>
<string>ShortcutsForeground</string>
<key>NSAppIconComplementingColorNames</key>
<array>
<string>ShortcutsBackground1</string>
<string>ShortcutsBackground2</string>
</array>
</dict>
</dict>
</dict>
Yes this is correct for timers.
To update the state when countdown reaches 0 here are some options:
Use a background task to end the live activity. You can set the “final state” here and choose the dismissal policy
set the staleDate and check in your view if data is stale
use push notifications
I'm also experiencing this issue. I'm using the following:
Button(intent: MyIntent()) {
Text("Do Thing")
}
It successfully runs the Intent, but it also launches the Shortcuts app unexpectedly. I believe this worked correctly in Beta 1, but regressed in Beta 2 and Beta 3.
I've filed FB12528352.
I'm having similar issues in 14.1 release. Have you found a fix?
Hi there - is there a further update on this issue? I couldn't see any mention of this in either iOS 16 RC or Xcode 14 RC release notes.
Additionally - at least for me - when used in widgets, .timer Text fields no longer count down.
FB11472058