Skip to content

Commit 9509848

Browse files
authored
Merge pull request #2 from teufelaudio/LottieAsset
Add LottieAsset back as requested in PR comments
2 parents 9850ad9 + effb10a commit 9509848

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
//
2+
// LottieAsset.swift
3+
// UIExtensions
4+
//
5+
// Created by Luiz Barbosa on 04.06.20.
6+
// Copyright © 2020 Lautsprecher Teufel GmbH. All rights reserved.
7+
//
8+
9+
import Foundation
10+
11+
public protocol LottieAsset {
12+
var filename: String { get }
13+
var bundle: Bundle { get }
14+
}

Sources/LottieExtensions/LottieView.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,13 @@ public struct LottieView: UIViewRepresentable {
2525
self.completion = completion
2626
}
2727

28+
public init(asset: LottieAsset, loopMode: LottieLoopMode = .playOnce, completion: LottieCompletionBlock? = nil) {
29+
self.filename = asset.filename
30+
self.bundle = asset.bundle
31+
self.loopMode = loopMode
32+
self.completion = completion
33+
}
34+
2835
public func makeUIView(context: UIViewRepresentableContext<LottieView>) -> UIView {
2936
let view = UIView()
3037
let animation = Animation.named(filename, bundle: bundle)

0 commit comments

Comments
 (0)