Few improvements for ComingSoon

This commit is contained in:
Lumaa 2024-03-23 09:48:29 +01:00
parent af07e2ce95
commit 3156877eff
2 changed files with 32 additions and 7 deletions

View File

@ -3,19 +3,18 @@
import SwiftUI
struct ComingSoonView: View {
init() {}
@State private var spin: CGFloat = 0
var body: some View {
VStack(spacing: 5) {
Text(String("👀"))
.font(.system(size: 62))
.rotation3DEffect(.degrees(spin), axis: (x: 0, y: 1, z: 0))
.onTapGesture {
withAnimation(.spring.speed(0.8)) {
spin = 360
}
spin = 0
}
.padding()
.background(Color.gray.opacity(0.3))
.clipShape(Circle())
.tapToSpin(spin: $spin)
Text("coming-soon")
.font(.title.bold())
@ -23,6 +22,19 @@ struct ComingSoonView: View {
}
}
extension View {
func tapToSpin(spin: Binding<CGFloat>, defaultValue: CGFloat = 0) -> some View {
self
.rotation3DEffect(.degrees(spin.wrappedValue), axis: (x: 0, y: 1, z: 0))
.onTapGesture {
withAnimation(.spring.speed(0.8)) {
spin.wrappedValue = 360
}
spin.wrappedValue = defaultValue
}
}
}
#Preview {
ComingSoonView()
}

View File

@ -0,0 +1,13 @@
//Made by Lumaa
import SwiftUI
struct RestrictedView: View {
var body: some View {
Text(/*@START_MENU_TOKEN@*/"Hello, World!"/*@END_MENU_TOKEN@*/)
}
}
#Preview {
RestrictedView()
}