Created
February 26, 2023 16:33
-
-
Save alpennec/f56cdc845f7c21a3f0118951b03a98c5 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
struct ContentView: View { | |
@State private var isPresentingA: Bool = false | |
@State private var isPresentingB: Bool = false | |
var body: some View { | |
NavigationStack { | |
Text("Hello, World!") | |
.toolbar { | |
ToolbarItem(placement: .cancellationAction) { | |
Button("A") { | |
isPresentingA = true | |
} | |
} | |
ToolbarItem(placement: .confirmationAction) { | |
Button("B") { | |
isPresentingB = true | |
} | |
} | |
} | |
.sheet(isPresented: $isPresentingA) { | |
NavigationStack { | |
Text("A") | |
} | |
} | |
.sheet(isPresented: $isPresentingB) { | |
NavigationStack { | |
Text("B") | |
} | |
} | |
} | |
} | |
} | |
struct ContentView_Previews: PreviewProvider { | |
static var previews: some View { | |
ContentView() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment