add swiftUI code
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
//
|
||||
// LottieView.swift
|
||||
// VPNUI
|
||||
//
|
||||
// Created by Mac on 2024/9/26.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
//import Lottie
|
||||
import SwiftUI
|
||||
import Lottie
|
||||
|
||||
struct LottieView: UIViewRepresentable {
|
||||
|
||||
var animationFileName: String
|
||||
let loopMode: LottieLoopMode
|
||||
|
||||
func updateUIView(_ uiView: UIViewType, context: Context) {
|
||||
|
||||
}
|
||||
|
||||
func makeUIView(context: Context) -> Lottie.LottieAnimationView {
|
||||
let animationView = LottieAnimationView(name: animationFileName)
|
||||
animationView.loopMode = loopMode
|
||||
animationView.play()
|
||||
animationView.contentMode = .scaleAspectFit
|
||||
|
||||
return animationView
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user