Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Example/Example/LottieViewLayoutDemoView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@ struct LottieViewLayoutDemoView: View {
HStack {
VStack {
LottieView(animation: .named("Samples/LottieLogo1"))
.configure(\.contentMode, value: .scaleAspectFit)
.looping()
.frame(maxWidth: 100)

Text("maxWidth: 100")
Text("maxWidth: 100, contentMode: .scaleAspectFit")
}

VStack {
Expand Down
10 changes: 10 additions & 0 deletions Sources/Public/Animation/LottieView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,16 @@ public struct LottieView<Placeholder: View>: UIViewConfiguringSwiftUIView {
}
}

/// Returns a copy of this `LottieView` updated to have the specific configuration property
/// applied to its represented `LottieAnimationView` whenever it is updated via the `updateUIView(...)`
/// or `updateNSView(...)` methods.
public func configure<Property>(
_ property: ReferenceWritableKeyPath<LottieAnimationView, Property>,
value: Property
) -> Self {
configure { $0[keyPath: property] = value }
}

/// Returns a copy of this `LottieView` updated to have the given closure applied to its
/// represented `LottieAnimationView` whenever it is updated via the `updateUIView(…)`
/// or `updateNSView(…)` method.
Expand Down