eas-widget-example
eas-widget-example copied to clipboard
[Question]: Lock Screen Widget
Maybe it's a dump question, but is it possible to use this widget as lockscreen widget as well?
@mariomurrent-softwaresolutions Yes I think this should also be possible. There are no extra configurations needed to add a widget to the lock screen so I don't see any problems. You should only add some new views which are designed to be used on the lock screen, and call them accordingly.
In the Apple Developer docs they provided an example: https://developer.apple.com/documentation/widgetkit/creating-lock-screen-widgets-and-watch-complications#Create-views-for-accessory-widgets
struct EmojiRangerWidgetEntryView: View {
var entry: Provider.Entry
@Environment(\.widgetFamily) var family
@ViewBuilder
var body: some View {
switch family {
case .accessoryInline:
// Code to construct the view for the inline widget or watch complication.
case .accessoryRectangular:
// Code to construct the view for the rectangular Lock Screen widget or watch complication.
case .accessoryCircular:
// Code to construct the view for the circular Lock Screen widget or watch complication.
case .systemSmall:
// Code to construct the view for the small widget.
default:
// Code to construct the view for other widgets; for example, the system medium or large widgets.
}
}
}
Very nice - i will try it out and let you know :)
@mariomurrent-softwaresolutions did this work?
@mariomurrent-softwaresolutions did this work?
Since I’m using the EAS build in managed workflow, where should this code be added?