mirror of
https://github.com/selfxyz/self.git
synced 2026-02-19 02:24:25 -05:00
* Clean up root license wording * Simplify SPDX header * simplify license and rename BSL to BUSL * fix merge issues * fix missing method --------- Co-authored-by: Justin Hernandez <transphorm@gmail.com>
40 lines
1.2 KiB
Swift
40 lines
1.2 KiB
Swift
// SPDX-License-Identifier: BUSL-1.1; Copyright (c) 2025 Social Connect Labs, Inc.; Licensed under BUSL-1.1 (see LICENSE); Apache-2.0 from 2029-06-11
|
|
|
|
//
|
|
// LottieView.swift
|
|
// FreedomTools
|
|
//
|
|
// Created by Ivan Lele on 27.02.2024.
|
|
//
|
|
import Lottie
|
|
import SwiftUI
|
|
struct LottieView: UIViewRepresentable {
|
|
var animationFileName: String
|
|
let loopMode: LottieLoopMode
|
|
|
|
func updateUIView(_ uiView: UIViewType, context: Context) {}
|
|
|
|
func makeUIView(context: Context) -> some UIView {
|
|
let view = UIView(frame: .zero)
|
|
|
|
let animationView = LottieAnimationView(name: animationFileName)
|
|
animationView.loopMode = loopMode
|
|
animationView.contentMode = .scaleAspectFit
|
|
animationView.play()
|
|
|
|
animationView.translatesAutoresizingMaskIntoConstraints = false
|
|
view.addSubview(animationView)
|
|
|
|
NSLayoutConstraint.activate([
|
|
animationView.widthAnchor.constraint(equalTo: view.widthAnchor),
|
|
animationView.heightAnchor.constraint(equalTo: view.heightAnchor)
|
|
])
|
|
|
|
return view
|
|
}
|
|
}
|
|
#Preview {
|
|
LottieView(animationFileName: "passport", loopMode: .loop)
|
|
.frame(width: 300)
|
|
}
|