Skip to content

Latest commit

 

History

History
33 lines (24 loc) · 812 Bytes

README.md

File metadata and controls

33 lines (24 loc) · 812 Bytes

Lottie Tutorial for watchOS with SwiftUI

About

This example demonstrates the usage of Lottie animations for watchOS with SwiftUI.

Steps to add it to your project:

struct ContentView: View {
    @ObservedObject var viewModel: LottieViewModel = .init()
    
    var body: some View {
        Image(uiImage: viewModel.image)
            .resizable()
            .scaledToFit()
            .onAppear {
                       self.viewModel.loadAnimation(url: URL(string: "https://assets8.lottiefiles.com/packages/lf20_Zz37yH.json")!)
                   }
    }
}

Requirements

  • Swift 5.0
  • watchOS 6.0+

Happy coding! 😀