Skip to content

Instantly share code, notes, and snippets.

@ashishkakkad8
Created August 24, 2022 18:05
Show Gist options
  • Save ashishkakkad8/c12ddb2f4fb9e4c65656a9d948a49439 to your computer and use it in GitHub Desktop.
Save ashishkakkad8/c12ddb2f4fb9e4c65656a9d948a49439 to your computer and use it in GitHub Desktop.
PassDataSwiftUI
//
// 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