Skip to content

Instantly share code, notes, and snippets.

@meyusufdemirci
Last active May 18, 2022 13:06
Show Gist options
  • Save meyusufdemirci/56c93c0f720f74945b9ff1185aa1decb to your computer and use it in GitHub Desktop.
Save meyusufdemirci/56c93c0f720f74945b9ff1185aa1decb to your computer and use it in GitHub Desktop.
Dynamic Alert and Sheet Article
struct ContentView: View {
@StateObject private var viewModel: ViewModel = .init()
var body: some View {
ZStack {
Text("Hello, from the content view!")
}
.alert(item: self.$viewModel.alert) { $0.alert }
.sheet(item: self.$viewModel.sheet) { $0.view }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment