Skip to content

Commit

Permalink
Merge pull request #45 from LottieFiles/feat/init-from-data
Browse files Browse the repository at this point in the history
feat: init from data
  • Loading branch information
samuelOsborne authored Nov 28, 2024
2 parents f20102e + ef98538 commit e877833
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions Sources/DotLottie/Public/DotLottieAnimation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,18 @@ public final class DotLottieAnimation: ObservableObject {
}
}

/// Load a .lottie file from Data.
public convenience init(
dotLottieData: Data,
config: AnimationConfig
) {
self.init(config: config) {
try $0.loadDotLottie(data: dotLottieData)
} errorMessage: { error in
"Failed to load dotLottie. Failed with error: \(error)"
}
}

@_disfavoredOverload
@available(*, deprecated)
public convenience init(
Expand Down

0 comments on commit e877833

Please sign in to comment.