This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import SwiftUI | |
import Lottie | |
struct LottieView: UIViewRepresentable { | |
typealias UIViewType = UIView | |
var filename: String | |
func makeUIView(context: UIViewRepresentableContext<LottieView>) -> UIView { | |
let view = UIView(frame: .zero) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NSLayoutConstraint.activate([ | |
animationView.widthAnchor.constraint(equalTo: view.widthAnchor), | |
animationView.heightAnchor.constraint(equalTo: view.heightAnchor), | |
animationView.centerXAnchor.constraint(equalTo: view.centerXAnchor), | |
animationView.centerYAnchor.constraint(equalTo: view.centerYAnchor) | |
]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let animationView = AnimationView() | |
let animation = Animation.named("YOUR_ANIMATION") | |
animationView.animation = animation | |
animationView.contentMode = .scaleAspectFit | |
animationView.play() | |
animationView.translatesAutoresizingMaskIntoConstraints = false | |
view.addSubview(animationView) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct LottieView: UIViewRepresentable { | |
func makeUIView(context: UIViewRepresentableContext<LottieView>) -> UIView { | |
let view = UIView(frame: .zero) | |
return view | |
} | |
func updateUIView(_ uiView: UIView, context: UIViewRepresentableContext<LottieView>) { } | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct SpinnerConfiguration { | |
var spinnerColor: Color = .white | |
var blurredBackground: Color = .black | |
var spinnerBackgroundColor: Color = .gray | |
var backgroundCornerRadius: CGFloat = 30 | |
var width: CGFloat = 50 | |
var height: CGFloat = 50 | |
var speed: Double = 1 | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var body: some View { | |
ZStack { | |
Color.black.opacity(0.8) | |
.edgesIgnoringSafeArea(.all) | |
.blur(radius: 200) | |
ZStack { | |
Color.gray.opacity(0.5) | |
Circle() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.shadow(color: Color.white.opacity(0.3), radius: 5, x: 0, y: 5) | |
.shadow(color: Color.black.opacity(0.1), radius: 2, x: 0, y: 2) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.shadow(color: Color.black.opacity(0.1), radius: 3, x: 0, y: 3) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ZStack { | |
Color.black.opacity(0.8) | |
.edgesIgnoringSafeArea(.all) | |
.blur(radius: 200) | |
... | |
} |
NewerOlder