Created
August 24, 2022 18:05
-
-
Save ashishkakkad8/c12ddb2f4fb9e4c65656a9d948a49439 to your computer and use it in GitHub Desktop.
PassDataSwiftUI
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
// | |
// FirstView.swift | |
// PassDataSwiftUI | |
// | |
// Created by Kode on 24/08/22. | |
// | |
import SwiftUI | |
struct FirstView: View { | |
@State private var showSecondView = false | |
var body: some View { | |
Button(action: { | |
self.showSecondView.toggle() | |
}, label: { | |
Text("Open Second View") | |
}) | |
.sheet(isPresented: $showSecondView){ | |
SecondView(data: "Hello 2nd") | |
} | |
} | |
} | |
struct FirstView_Previews: PreviewProvider { | |
static var previews: some View { | |
FirstView() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment