// // SplitAddEditView.swift // Workouts // // Created by rzen on 7/18/25 at 9:42 AM. // // Copyright 2025 Rouslan Zenetl. All Rights Reserved. // import SwiftUI struct SplitAddEditView: View { @State var model: Split private let availableColors = ["red", "orange", "yellow", "green", "mint", "teal", "cyan", "blue", "indigo", "purple", "pink", "brown"] private let availableIcons = ["dumbbell.fill", "figure.strengthtraining.traditional", "figure.run", "figure.hiking", "figure.cooldown", "figure.boxing", "figure.wrestling", "figure.gymnastics", "figure.handball", "figure.core.training", "heart.fill", "bolt.fill"] var body: some View { Form { Section(header: Text("Name")) { TextField("Name", text: $model.name) .bold() } Section(header: Text("Appearance")) { Picker("Color", selection: $model.color) { ForEach(availableColors, id: \.self) { colorName in let tempSplit = Split(name: "", color: colorName) HStack { Circle() .fill(tempSplit.getColor()) .frame(width: 20, height: 20) Text(colorName.capitalized) } .tag(colorName) } } Picker("Icon", selection: $model.systemImage) { ForEach(availableIcons, id: \.self) { iconName in HStack { Image(systemName: iconName) .frame(width: 24, height: 24) Text(iconName.replacingOccurrences(of: ".fill", with: "").replacingOccurrences(of: "figure.", with: "").capitalized) } .tag(iconName) } } } Section(header: Text("Exercises")) { NavigationLink { SplitExercisesListView(model: model) } label: { ListItem( text: "Exercises", count: model.exercises?.count ?? 0 ) } } } } }