Skip to content

Instantly share code, notes, and snippets.

@cgiacomi
Last active April 13, 2020 09:26
Show Gist options
  • Save cgiacomi/5ffb41cc208a9be5c8b260c3dccd0196 to your computer and use it in GitHub Desktop.
Save cgiacomi/5ffb41cc208a9be5c8b260c3dccd0196 to your computer and use it in GitHub Desktop.
import SwiftUI
struct SampleView: View {
@State private var showOptionsMenu: Bool = false
var numbers = ["1","2","3","4","5","6","7","8"]
var body: some View {
ZStack {
List(self.numbers, id: \.self) { number in
Text(number)
}
// Reproduceable also by commenting this out and removing the HalfModalView
//Text("Hello")
// .frame(width: UIScreen.main.bounds.size.width, height: UIScreen.main.bounds.size.height)
HalfModalView(isShown: $showOptionsMenu) {
Text("Hello")
}
}
.navigationBarTitle(Text("Nav Title"))
.navigationBarItems(
trailing:
Button(action: {
self.showOptionsMenu = true
}) {
Text("Options")
}
)
}
}
struct SampleView_Previews: PreviewProvider {
static var previews: some View {
NavigationView {
SampleView()
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment