//
// GegeApp.swift
// Gege
//
// Created by Besleaga Alexandru Marian on 5/15/21.
//
import SwiftUI
@main
struct GegeApp: App {
var body: some Scene {
WindowGroup {
Text("Besleaga Alexandru Marian")
}
#if os(macOS)
Settings {
SettingsView()
}
#endif
}
}
struct GeneralSettingsView: View {
@AppStorage("showPreview") private var showPreview = true
@AppStorage("fontSize") private var fontSize = 12.0
var body: some View {
Form {
Toggle("Show Previews", isOn: $showPreview)
Slider(value: $fontSize, in: 9...96) {
Text("Font Size (\(fontSize, specifier: "%.0f") pts)")
}
}
.padding(20)
.frame(width: 350, height: 100)
}
}
struct SettingsView: View {
private enum Tabs: Hashable {
case general, advanced
}
var body: some View {
TabView {
GeneralSettingsView()
.tabItem {
Label("General", systemImage: "gear")
}
.tag(Tabs.general)
`AdvancedSettingsView()`
.tabItem {
Label("Advanced", systemImage: "star")
}
.tag(Tabs.advanced)
}
.padding(20)
.frame(width: 375, height: 150)
}
}
Cannot find AdvancedSettingsView in scope ?
Selecting any option will automatically load the page