Files
divkit/client/ios/DivKitExtensions/Animations/AnimationBlockView+UIViewRenderableBlock.swift
denlvovich e001d74afe Update to VGSL6.0
4f8b5f480ade3f347d5f0a2d01a1618069bcb846
2024-07-12 20:33:42 +03:00

42 lines
974 B
Swift

import AVFoundation
import UIKit
import DivKit
import LayoutKit
import VGSL
extension LottieAnimationBlock {
static func makeBlockView() -> BlockView {
AnimationBlockView()
}
func canConfigureBlockView(_ view: BlockView) -> Bool {
view is AnimationBlockView
}
func configureBlockView(
_ view: BlockView,
observer _: ElementStateObserver?,
overscrollDelegate _: ScrollDelegate?,
renderingDelegate _: RenderingDelegate?
) {
let lottieView = view as! AnimationBlockView
if lottieView.animationHolder != animationHolder {
lottieView.animatableView = animatableView.value
lottieView.animationContentMode = scale.contentMode
lottieView.animationHolder = animationHolder
}
}
}
extension DivImageScale {
fileprivate var contentMode: UIView.ContentMode {
switch self {
case .fit: .scaleAspectFit
case .fill: .scaleAspectFill
case .noScale: .center
case .stretch: .scaleToFill
}
}
}