Я пробовал создать массив «изображений». Затем я присвоил метод UIImage.animatedImage(with: images, period: 1.0) переменной с именем "animatedImage"
наконец, я попробовал Image(uiImage: animatedImage) в "body" "ContentView.swift"
Код: Выделить всё
var images: [UIImage]! = [UIImage(named: "Sequence/frame-1")!,
UIImage(named: "Sequence/frame-2")!,
UIImage(named: "Sequence/frame-3")!,
UIImage(named: "Sequence/frame-4")!,
UIImage(named: "Sequence/frame-5")!,
UIImage(named: "Sequence/frame-6")!
]
let animatedImage : UIImage! = UIImage.animatedImage(with: images, duration: 1.0)
//////Then in the ContentView.swift I've tried this code:
struct ContentView : View {
var body: some View {
Image(uiImage: animatedImage)
}
}
Подробнее здесь: https://stackoverflow.com/questions/567 ... ng-swiftui
Мобильная версия