fix repetitive save of WorkoutItem, add: Onboarding, Defaults, Settings, Trainer/Trainee skeletons, reorder files, remove all Bindable
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
//
|
||||
// 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()
|
||||
}
|
||||
Reference in New Issue
Block a user