Skip to content

Instantly share code, notes, and snippets.

@LJNIC

LJNIC/Test.swift Secret

Created August 6, 2021 13:17
Show Gist options
  • Save LJNIC/dbddd5ef45d3f2e73e953d08e8fe0ea3 to your computer and use it in GitHub Desktop.
Save LJNIC/dbddd5ef45d3f2e73e953d08e8fe0ea3 to your computer and use it in GitHub Desktop.
extension Color {
static let myAppBgColor = Color.white
}
struct Screen<Content>: View where Content: View {
let content: () -> Content
var body: some View {
ZStack {
Color.myAppBgColor.edgesIgnoringSafeArea(.all)
content()
}
}
}
struct Root: View {
var body: some View {
NavigationStackView(easing: .easeIn(duration: 3)) {
A()
}
}
}
struct A: View {
var body: some View {
Screen {
VStack(spacing: 50) {
Text("Hello World")
LazyVGrid(columns: [.init(.flexible())]) {
ForEach(0..<20) { i in
Text("Won't Transition")
}
}
PushView(destination: B()) {
Text("PUSH")
}
}
.background(Color.green)
}
}
}
struct B: View {
var body: some View {
Screen {
PopView {
Text("POP")
}
.background(Color.yellow)
}
}
}
struct Test_Previews: PreviewProvider {
static var previews: some View {
Root()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment