71 lines
1.6 KiB
Swift
71 lines
1.6 KiB
Swift
//
|
|
// Settings.swift
|
|
// WorkoutsPlus
|
|
//
|
|
// Created by Felix Förtsch on 30.08.24.
|
|
//
|
|
|
|
import SwiftUI
|
|
|
|
// TODO: Import/Export Workouts/Exercises
|
|
// https://www.avanderlee.com/swift/json-parsing-decoding/
|
|
struct Settings: View {
|
|
@Default(\.isDebug) var isDebug
|
|
@Default(\.isFirstAppStart) var isFirstAppStart
|
|
@Default(\.isOnboarding) var isOnboarding
|
|
@Default(\.isTrainerMode) var isTrainerMode
|
|
@Default(\.userId) var userId
|
|
@Default(\.reps) var reps
|
|
|
|
var body: some View {
|
|
List {
|
|
Section(
|
|
header: Text("User"),
|
|
footer: Text("Trainer Mode enables you to add and manage trainees.")) {
|
|
Text(userId)
|
|
TextField("name", text: $userId)
|
|
Toggle(isOn: $isTrainerMode) {
|
|
Text("Trainer Mode")
|
|
}
|
|
}
|
|
Section(header: Text("Defaults")) {
|
|
StepperListItem(itemName: "Rep Count", itemValue: $reps)
|
|
}
|
|
Text(String(reps))
|
|
Section(header: Text("Danger Zone")) {
|
|
Toggle(isOn: $isDebug) {
|
|
Text("isDebug")
|
|
}
|
|
Toggle(isOn: $isOnboarding) {
|
|
Text("isOnboarding ")
|
|
}
|
|
Button("Reset App", role: .destructive, action: resetApp)
|
|
}
|
|
|
|
Section {
|
|
NavigationLink("Credits") {
|
|
Text(
|
|
"""
|
|
# Software Components
|
|
## Duration Picker
|
|
https://github.com/mac-gallagher/DurationPicker
|
|
"""
|
|
)
|
|
}
|
|
}
|
|
}
|
|
.navigationTitle("Settings")
|
|
}
|
|
|
|
private func resetApp() {
|
|
isFirstAppStart = true
|
|
isOnboarding = true
|
|
}
|
|
}
|
|
|
|
#Preview {
|
|
NavigationStack {
|
|
Settings()
|
|
}
|
|
}
|