This project is for learning SwiftUI. We are mainly committing layout samples.
Xcode11.1
SwiftUI
Mac OS 10.15(19A583)
This layout is simply Card List Layout.
This layout is Side Menu Layout.
This is a sample layout that displays the side menu when you tap the button.
This is Card Animation Layout.
Tap the card to enlarge the view to the full screen size.
Since the animation is attached, the view can be enlarged smoothly.
The display logic is very simple.
Use the @State modifier to bind button taps.
Next, simply use the ternary operator to set the properties used in @State in the View frame.
struct CardAnimationView: View {
@State var show = false
var body: some View {
Button(action: {
withAnimation {
self.show.toggle()
}
}) {
VStack() {
Text("SwiftUI-Layout")
.foregroundColor(.white)
.fontWeight(.bold)
.font(.largeTitle)
.padding(.top, show ? 100 : 20)
Spacer()
}
.padding()
.frame(width: show ? ScreenSize.width : 300, height: show ? ScreenSize.height : 300)
.background(Color.blue)
}
.cornerRadius(30)
.animation(.spring())
}
}
This is UserDefautlt Test by PropertyWrappers.