I'm using this Lottie library to render a lottie animation in SwiftUI.
This is my lottie file, as you can see it is flush against the left margin (left aligned)

Now I try to load this in my app in SwiftUI as follows:
Код: Выделить всё
VStack(alignment: .leading, spacing: .zero) {
LottieView(animation: .named("loading-animation"))
.playing(loopMode: .loop)
.frame(height: 40)
}

Not sure why the above code doesn't work as is to align the lottie animation to the left as if I just use another view with this code (A rectangle for example,) it will be left aligned as expected.
How can I make a Lottie animation view align to the left in SwiftUI ?
Источник: https://stackoverflow.com/questions/781 ... in-swiftui
Мобильная версия