I implemented a simple control center widget for iOS18 but I cannot find a way to correctly render my image in the control. This is my code:
@available(iOS 18.0, *)
struct ShortcutControlWidget: ControlWidget {
private let kind: String = "shortcut"
private let name = LocalizedStringResource(stringLiteral: "key1")
public var body: some ControlWidgetConfiguration {
StaticControlConfiguration(kind: kind) {
ControlWidgetButton(action: OpenShortcutIntent()) {
Label("key1" image: "image1")
}
}
.displayName(name)
}
}
I already have a lockscreen widget that correctly displays Image("image1")
without issues in this same extension. I tried other initialisers for for Label
but the result is always this control with a ?
symbol:
I am on iOS 18 beta 7 and building with Xcode 16.0.0-Beta.6.
ControlWidgetButton
implements ControlWidgetTemplate
which is documented to only support symbol images (although this worked in beta 3).
These templates define images (specifically, symbol images) [...]
I have transformed my images to custom symbols and it worked.