Add 'ios/' from commit '2220a0d4f2bb0f0ebca509581c21d6c90359bd14'
git-subtree-dir: ios git-subtree-mainline:52968df567git-subtree-split:2220a0d4f2
This commit is contained in:
@@ -0,0 +1,61 @@
|
||||
//
|
||||
// SettingsView.swift
|
||||
// QueueCube
|
||||
//
|
||||
// Created by James Magahern on 5/2/25.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct SettingsView: View
|
||||
{
|
||||
let onDone: () -> Void
|
||||
@State private var navigationPath: [SettingsPage]
|
||||
|
||||
init(onDone: @escaping () -> Void) {
|
||||
self.onDone = onDone
|
||||
self.navigationPath = if !Settings.fromDefaults().isConfigured {
|
||||
// Show server settings if not configured.
|
||||
[ .servers ]
|
||||
} else {
|
||||
[]
|
||||
}
|
||||
}
|
||||
|
||||
var body: some View {
|
||||
NavigationStack(path: $navigationPath) {
|
||||
List {
|
||||
NavigationLink(value: SettingsPage.general) {
|
||||
Image(systemName: "gear")
|
||||
Text(.general)
|
||||
}
|
||||
|
||||
NavigationLink(value: SettingsPage.servers) {
|
||||
Image(systemName: "server.rack")
|
||||
Text(.servers)
|
||||
}
|
||||
}
|
||||
.navigationDestination(for: SettingsPage.self, destination: { page in
|
||||
Group {
|
||||
switch page {
|
||||
case .general: GeneralSettingsView()
|
||||
case .servers: ServerListSettingsView()
|
||||
}
|
||||
}
|
||||
.navigationBarTitleDisplayMode(.inline)
|
||||
})
|
||||
.navigationBarTitleDisplayMode(.inline)
|
||||
.navigationTitle(.settings)
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Types
|
||||
|
||||
enum SettingsPage: String, Identifiable
|
||||
{
|
||||
var id: String { rawValue }
|
||||
|
||||
case general
|
||||
case servers
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user