Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Question]: Lock Screen Widget #4

Open
mariomurrent-softwaresolutions opened this issue Apr 14, 2023 · 4 comments
Open

[Question]: Lock Screen Widget #4

mariomurrent-softwaresolutions opened this issue Apr 14, 2023 · 4 comments

Comments

@mariomurrent-softwaresolutions

Maybe it's a dump question, but is it possible to use this widget as lockscreen widget as well?

@aLemonFox
Copy link

@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.
        }
    }
}

@mariomurrent-softwaresolutions
Copy link
Author

Very nice - i will try it out and let you know :)

@rkstar
Copy link

rkstar commented Oct 2, 2023

@mariomurrent-softwaresolutions did this work?

@mariomurrent-softwaresolutions
Copy link
Author

@mariomurrent-softwaresolutions did this work?

Since I’m using the EAS build in managed workflow, where should this code be added?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants