Files
ansestepanov a7157e0a3b supported is_playing for lottie_extension
commit_hash:141d52250afaad7f30e96b471cf6d100af568bad
2025-07-15 12:40:37 +03:00

53 lines
1.4 KiB
Swift

import Foundation
import LayoutKit
import VGSL
public protocol AsyncSourceAnimatableViewFactory: AnyObject {
func createAsyncSourceAnimatableView(withMode mode: AnimationRepeatMode, repeatCount count: Float)
-> AsyncSourceAnimatableView
}
/// This protocol is deprecated. Use AsyncSourceAnimatableViewFactory instead.
public protocol AnimatableViewFactory: AnyObject, AsyncSourceAnimatableViewFactory {
func createAnimatableView(withMode mode: AnimationRepeatMode, repeatCount count: Float)
-> AnimatableView
}
extension AnimatableViewFactory {
public func createAsyncSourceAnimatableView(
withMode mode: AnimationRepeatMode,
repeatCount count: Float
) -> AsyncSourceAnimatableView {
createAnimatableView(withMode: mode, repeatCount: count)
}
}
public protocol AsyncSourceAnimatableView: ViewType {
func play()
func pause()
@MainActor func setSourceAsync(_ source: AnimationSourceType) async
}
extension AsyncSourceAnimatableView {
func pause() {
assertionFailure("AsyncSourceAnimatableView needs to implement pause()")
}
}
/// This protocol is deprecated. Use AsyncSourceAnimatableView instead.
public protocol AnimatableView: AsyncSourceAnimatableView {
func setSource(_ source: AnimationSourceType)
}
extension AnimatableView {
@MainActor public func setSourceAsync(_ source: AnimationSourceType) async {
setSource(source)
}
}
@frozen
public enum AnimationRepeatMode {
case restart
case reverse
}