61 lines
1.8 KiB
Swift
61 lines
1.8 KiB
Swift
//
|
|
// ContentView.swift
|
|
// Interject!
|
|
//
|
|
// Created by Rory Hinnen on 21/11/18.
|
|
//
|
|
|
|
import SwiftUI
|
|
|
|
struct ContentView: View {
|
|
@EnvironmentObject var settings: Settings/Users/roryhinnen/Downloads/Dungeon Project
|
|
@EnvironmentObject var store: Store
|
|
@State var displaySettingsView: Bool = false
|
|
@State var preferredColorScheme: ColorScheme? = nil
|
|
|
|
var body: some View {
|
|
SentenceView()
|
|
.contentShape(Rectangle())
|
|
.padding()
|
|
.edgesIgnoringSafeArea(.all)
|
|
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
|
.contentShape(Rectangle())
|
|
.foregroundColor(Color("Foreground"))
|
|
.background(Color("Background"))
|
|
.gesture(DragGesture()
|
|
.onEnded { value in
|
|
let direction = value.detectDirection()
|
|
switch direction {
|
|
case .up:
|
|
settings.remove()
|
|
case .down:
|
|
settings.add()
|
|
default:
|
|
break
|
|
}
|
|
})
|
|
.toolbar {
|
|
ToolbarItemGroup(placement: .bottomBar) {
|
|
ToolbarView(displaySettingsView: $displaySettingsView)
|
|
.foregroundColor(Color("Foreground"))
|
|
}
|
|
}
|
|
.preferredColorScheme(settings.colorScheme.type)
|
|
.sheet(isPresented: $displaySettingsView) {
|
|
VStack {
|
|
SettingsView()
|
|
Button("Accept", action: {displaySettingsView.toggle()})
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
struct ContentView_Previews: PreviewProvider {
|
|
static var previews: some View {
|
|
ContentView()
|
|
.environmentObject(Settings())
|
|
.environmentObject(Store())
|
|
}
|
|
}
|