// // SettingsView.swift // Lunch Card // // Created by Joshua Srery on 2/1/21. // import SwiftUI struct SettingsView: View { @State private var selectedAppearance = 1 @Binding var colorScheme: ColorScheme? var body: some View { NavigationView { Form { Section(header: Text("Customization")) { Picker(selection: $selectedAppearance, label: Text("Appearance")) { Text("System Default").tag(1) Text("Light").tag(2) Text("Dark").tag(3) } .onChange(of: selectedAppearance) { value in //print(selectedAppearance) switch selectedAppearance { case 1: //print("System Default") colorScheme = nil case 2: //print("Light") colorScheme = .light case 3: //print("Dark") colorScheme = .dark default: break } } } Section(header: Text("Feedback")) { Link("Leave a Review", destination: URL(string: "https://apps.apple.com/us/app/lunch-card-id-card-manager/id1546901593")!) Link("Report a Bug", destination: URL(string: "mailto:redactedemail@example.com?subject:Re:%20Lunch%20Card")!) } Section { NavigationLink(destination: ColophonView()) { Text("Colophon") } } } .navigationTitle("Settings") } .onAppear { switch colorScheme { case .none: selectedAppearance = 1 case .light: selectedAppearance = 2 case .dark: selectedAppearance = 3 default: break } } } } struct ColophonView: View { @Environment(\.colorScheme) var colorScheme var body: some View { ScrollView { Text("Lunch Card was built in Xcode 12.3+ on a 15 inch, 2019 Macbook Pro running macOS Big Sur.\n\nI'd like to thank the LPS school district for letting the idea spark. Lunch Card wouldn't exist without the new precautions.\n\nI would also like to thank Apple Developer Forums user OOPer for providing most of the code to power the card system. This app would still be in development (probably for more than a year) without their help.") .padding() .font(.system(.body, design: .monospaced)) } } }