45 lines
901 B
Swift
45 lines
901 B
Swift
//
|
|
// Settings.swift
|
|
// WorkoutsPlus
|
|
//
|
|
// Created by Felix Förtsch on 30.08.24.
|
|
//
|
|
|
|
import SwiftUI
|
|
|
|
struct Settings: View {
|
|
@Default(\.isFirstAppStart) var isFirstAppStart
|
|
@Default(\.isOnboarding) var isOnboarding
|
|
@Default(\.userId) var userId
|
|
@Default(\.reps) var reps
|
|
|
|
var body: some View {
|
|
List {
|
|
Section(header: Text("User")) {
|
|
Text(userId)
|
|
TextField("name", text: $userId)
|
|
}
|
|
Section(header: Text("Defaults")) {
|
|
StepperListItem(itemName: "Rep Count", itemValue: $reps)
|
|
}
|
|
Text(String(reps))
|
|
Section(header: Text("Danger Zone")) {
|
|
|
|
Toggle(isOn: $isOnboarding) {
|
|
Text("isOnboarding")
|
|
}
|
|
Button("Reset App", role: .destructive, action: resetApp)
|
|
}
|
|
}
|
|
}
|
|
|
|
private func resetApp() {
|
|
isFirstAppStart = true
|
|
isOnboarding = true
|
|
}
|
|
}
|
|
|
|
#Preview {
|
|
Settings()
|
|
}
|