Post

Replies

Boosts

Views

Activity

Reply to Unable to set the new App Tint Color options for App Shortcuts
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>
Topic: App & System Services SubTopic: General Tags:
Jul ’23
Reply to Widget URL on complication
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.
Topic: App & System Services SubTopic: General Tags:
Jul ’23
Reply to Does HealthKit in iOS 17 provide any APIs related to mood tracking?
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.
Aug ’23
Reply to Siri Watch Face and RelevantIntentManager
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.
Topic: App & System Services SubTopic: Core OS Tags:
Oct ’23
Reply to Xcode 15: Core Data : No NSValueTransformer with class name XXX was found for attribute YYY on entity ZZZ for custom `NSSecureUnarchiveFromDataTransformer`
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.
Oct ’23
Reply to Control Center Widget: Unable to read configuration from ControlConfigurationIntent in SetValueIntent
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.
Topic: App & System Services SubTopic: General Tags:
Jul ’24
Reply to WidgetKit / SwiftUI Text Timer Bug. This has remained a bug for a very long time.
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
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Sep ’22
Reply to AppShortcuts are not showing up when using CustomIntentMigratedAppIntent with Xcode 14.1 beta 3.
I'm having similar issues in 14.1 release. Have you found a fix?
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Oct ’22
Reply to How to run Shortcuts using App Intent without opening the Shortcuts App
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.
Topic: App & System Services SubTopic: General Tags:
Replies
Boosts
Views
Activity
Jul ’23
Reply to How to show count down timer in live activity?
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
Replies
Boosts
Views
Activity
Jul ’23
Reply to Unable to set the new App Tint Color options for App Shortcuts
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>
Topic: App & System Services SubTopic: General Tags:
Replies
Boosts
Views
Activity
Jul ’23
Reply to NSPersistentCloudKitContainer CKRecord conversion errors
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.
Replies
Boosts
Views
Activity
Jul ’23
Reply to Widget URL on complication
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.
Topic: App & System Services SubTopic: General Tags:
Replies
Boosts
Views
Activity
Jul ’23
Reply to Xcode 15 beta Command PhaseScriptExecution failed with a nonzero exit code
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
Replies
Boosts
Views
Activity
Aug ’23
Reply to Does HealthKit in iOS 17 provide any APIs related to mood tracking?
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.
Replies
Boosts
Views
Activity
Aug ’23
Reply to Siri Watch Face and RelevantIntentManager
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.
Topic: App & System Services SubTopic: Core OS Tags:
Replies
Boosts
Views
Activity
Oct ’23
Reply to WidgetKit widget is blank when app is installed from TestFlight
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).
Topic: App & System Services SubTopic: General Tags:
Replies
Boosts
Views
Activity
Oct ’23
Reply to Xcode 15: Core Data : No NSValueTransformer with class name XXX was found for attribute YYY on entity ZZZ for custom `NSSecureUnarchiveFromDataTransformer`
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.
Replies
Boosts
Views
Activity
Oct ’23
Reply to Start a Live Activity from the new ControlWidget
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( ... ) } }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Jun ’24
Reply to Xcode 15: Core Data : No NSValueTransformer with class name XXX was found for attribute YYY on entity ZZZ for custom `NSSecureUnarchiveFromDataTransformer`
Still present in Xcode 16 Beta 1.
Replies
Boosts
Views
Activity
Jun ’24
Reply to Control Center Widget: Unable to read configuration from ControlConfigurationIntent in SetValueIntent
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.
Topic: App & System Services SubTopic: General Tags:
Replies
Boosts
Views
Activity
Jul ’24