@OOPer
import SwiftUI
struct ContentView: View {
@State private var showingSheet = false
var body: some View {
ZStack{
VStack{
Text("Reference Buddy :D")
.font(.title)
.fontWeight(.bold)
HStack{
Button("Physics") {
self.showingSheet.toggle()
}
.sheet(isPresented: $showingSheet) {
physicsPage()
}
Button("Trigonometry", action: {})
Button("Calculus", action: {})
}
HStack{
Button("Pre-calculus", action: {})
Button("Geometry", action: {})
Button("Statistics", action: {})
}
HStack{
Button("Chemistry", action: {})
Button("Biology", action: {})
Button("Astronomy", action: {})
}
}
}
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}
struct physicsPage: View {
@Environment(\.presentationMode) var presentationMode
var body: some View {
VStack{
Text("Did you know that...")
ForEach((1...10), id: \.self) {
Text("\($showingSheet)")
}
Button("Back") {
self.presentationMode.wrappedValue.dismiss()
}
}
}
}