iOS 16 WidgetKit Lock Screen Animated GIFs

Viewed 32

Starting with iOS 16, it's possible to display animated GIFs on the Lock Screen using WidgetKit.

Some Apps that currently support this feature:

I've tried it myself with the following code:

struct AnimatedGIFWidgetEntryView : View {
    var entry: Provider.Entry

    var gif : UIImage {
        
        UIImage(data: try! Data(contentsOf: Bundle.main.url(forResource: "test2", withExtension: "gif")!))!

    }
    
    var body: some View {
        Image(uiImage: gif)
    }
}

but that only shows the first frame of the GIF.

Am I missing something?

I've created a sample project: https://github.com/guidev/AnimatedGIF

0 Answers
Related