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,64 @@
|
||||
//
|
||||
// DebugList.swift
|
||||
// WorkoutsPlus
|
||||
//
|
||||
// Created by Felix Förtsch on 30.08.24.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
import SwiftData
|
||||
|
||||
struct DebugList: View {
|
||||
@Query(sort: \Exercise.name) private var exercises: [Exercise]
|
||||
@Query(sort: \Workout.name) private var workouts: [Workout]
|
||||
@Query(sort: \WorkoutItem.name) private var workoutItems: [WorkoutItem]
|
||||
|
||||
var body: some View {
|
||||
List {
|
||||
Section(header: Text("Exercises")) {
|
||||
ForEach(exercises) { exercise in
|
||||
DebugListItem(item: exercise)
|
||||
}
|
||||
}
|
||||
Section(header: Text("Workouts")) {
|
||||
ForEach(workouts) { workout in
|
||||
DebugListItem(item: workout)
|
||||
}
|
||||
}
|
||||
Section(header: Text("WorkoutItems")) {
|
||||
ForEach(workoutItems) { workoutItem in
|
||||
VStack(alignment: .leading) {
|
||||
Text("\(workoutItem.name), pos: \(workoutItem.position), reps: \(workoutItem.reps)")
|
||||
Text(workoutItem.id.uuidString)
|
||||
.font(.system(size: 12, weight: .bold))
|
||||
.fontDesign(.monospaced)
|
||||
.foregroundStyle(.gray)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.tabItem {
|
||||
Image(systemName: "wrench")
|
||||
Text("Exercise Debug")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct DebugListItem: View {
|
||||
var item: any Nameable
|
||||
|
||||
var body: some View {
|
||||
VStack(alignment: .leading) {
|
||||
Text(item.name)
|
||||
Text(item.id.uuidString)
|
||||
.font(.system(size: 12, weight: .bold))
|
||||
.fontDesign(.monospaced)
|
||||
.foregroundStyle(.gray)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#Preview {
|
||||
DebugList()
|
||||
.modelContainer(SampleData.shared.modelContainer)
|
||||
}
|
||||
Reference in New Issue
Block a user