Skip to content

Instantly share code, notes, and snippets.

@donchan922
Created May 10, 2020 06:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save donchan922/8253e5fd0e34f31d9a11973ec596ed37 to your computer and use it in GitHub Desktop.
Save donchan922/8253e5fd0e34f31d9a11973ec596ed37 to your computer and use it in GitHub Desktop.
struct ContentView: View {
@Environment(\.managedObjectContext) var context
@State private var isShowingModal = false
var body: some View {
Button(action: {
self.isShowingModal.toggle()
}) {
Text("go to SubView")
}.sheet(isPresented: $isShowingModal) {
SubView().environment(\.managedObjectContext, self.context)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment