Post

Replies

Boosts

Views

Activity

ControlWidgetToggle icon format
What format can the image be in for a ControlWidgetIcon? Can we use .svg and .png? Or does it have to be a systemImage? In XCode16-beta4 this code worked: AppIntentControlConfiguration( kind: WidgetConfig.Constants.controlCenterLock, provider: Provider()) { value in ControlWidgetToggle( "Lock/Unlock", isOn: !value.isLocked, action: LockUnlockToggleIntent(), valueLabel: { isUnlocked in Label( isUnlocked ? "Unlocked" : "Locked", image: isUnlocked ? "controlUnlocked" : "controlLocked") }) }) Where "controlUnlocked"/"controlLocked" were the names of Assets in the Widget extension asset catalogue. But in XCode-beta 6, the icons show a question mark. I can only get icons to show by using systemImage Label( isUnlocked ? "Unlocked" : "Locked", systemImage: isUnlocked ? "lock.open": "lock.fill" ) Is it a bug that it isn't loading the icons? Is there a format for the icons? Or are only systemImage icons supported?
2
0
476
Sep ’24
ControlPushHandler pushTokensDidChange never called
I'm trying to implement push notifications to update Control Center Widget as described here: https://developer.apple.com/documentation/widgetkit/updating-controls-locally-and-remotely#Use-push-notifications-to-reload-controls I've made my handler import WidgetKit import CommonTools @available(iOSApplicationExtension 18.0, *) struct ControlCenterPushHandler: ControlPushHandler { func pushTokensDidChange(controls: [ControlInfo]) { print("pushTokensDidChange called. \(controls)") controls.forEach{ print("ControlInfo \($0)") } } } And registered it for my controls var body: some ControlWidgetConfiguration { AppIntentControlConfiguration( kind: WidgetConfig.Constants.controlCenterLock, provider: Provider()) { value in ControlWidgetToggle( "Lock/Unlock", ... } .pushHandler(ControlCenterPushHandler.self) } } and then run my software on an iPhone 15 pro running iOS 18 developer beta 7. pushTokensDidChange is not called as I add and remove controls from the control panel. Or ever for that matter. If I inspect push tokens when my currentValue code runs struct Provider: AppIntentControlValueProvider { func currentValue(configuration: ControlCenterButtonConfiguration) async throws -> Value { let controls = try await ControlCenter.shared.currentControls() controls.forEach{ print("ControlInfo \($0)") } pushInfo is always nil ControlInfo ControlInfo(kind: "ControlCenterLock", pushInfo: nil, control:... What steps are needed to get a push token?
4
1
555
Aug ’24