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?

Answered by Mcorey in 802881022

It's my understanding that only SFSymbols are supported for Control Widget icons - I have no documentation for that, but have seen a lot of chatter on socials

Hi,

Please see the Asset Catalog Format Reference for information on supported file types for assets. Historically, png is preferred for images.

Rico

WWDR - DTS - Software Engineer

Accepted Answer

It's my understanding that only SFSymbols are supported for Control Widget icons - I have no documentation for that, but have seen a lot of chatter on socials

ControlWidgetToggle icon format
 
 
Q