-
-
Save LJNIC/dbddd5ef45d3f2e73e953d08e8fe0ea3 to your computer and use it in GitHub Desktop.
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
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