I create a launch control widget with these code:
@available(iOS 18.0, *)
struct LockScreenAppLaunchWidget: ControlWidget {
var body: some ControlWidgetConfiguration {
StaticControlConfiguration(kind: "com.example.lockscreenlauncher") {
ControlWidgetButton(action: LaunchAppIntent()) {
Label {
Text("AppName")
} icon: {
Image("custom_icon").renderingMode(.original).resizable()
}
}
}
.displayName("Open app")
}
}
I create a new xcassets file to store this icon image, named Media.xcassets, and its target is attach to WidgetExtension and main APP.
But when I run the build, this control's icon is still show as placeholder(a ? symbol in a dash rect).
below are some try
Label("AppName", systemImage: "heart") // is ok
Label("AppName", image: "custom_icon") // is not ok
According to Apple Documentation ControlWidget conforms to ControlWidgetTemplate which states
These templates define images (specifically, symbol images)
So, in order to have custom image, that image must be an SF Symbol. You can refer to this document for custom implementation. Or you can simply use Create Custom Symbols App from App Store. Just open your existing SVG in the app and it creates a custom SFSymbol.