Skip to content

Instantly share code, notes, and snippets.

@VictorCoding
Created December 6, 2020 21:50
Show Gist options
  • Save VictorCoding/55dabae7528c4b6db200ba3bf713cb3c to your computer and use it in GitHub Desktop.
Save VictorCoding/55dabae7528c4b6db200ba3bf713cb3c to your computer and use it in GitHub Desktop.
struct SheetButton<Content>: View where Content : View {
var activity: [String:String]
var content: Content
@State var isPresented = false
init(_ activity: [String:String], @ViewBuilder content: () -> Content) {
self.activity = activity
self.content = content()
}
var body: some View {
Button(action: {
self.isPresented.toggle()
}) {
//
}
.sheet(isPresented: $isPresented) {
self.content
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment