This commit is contained in:
2025-07-18 17:41:23 -04:00
parent 66f257609f
commit 34942bfc48
9 changed files with 337 additions and 111 deletions

View File

@ -0,0 +1,30 @@
//
// OrderableItem.swift
// Workouts
//
// Created by rzen on 7/18/25 at 5:19 PM.
//
// Copyright 2025 Rouslan Zenetl. All Rights Reserved.
//
import Foundation
/// Protocol for items that can be ordered in a sequence
protocol OrderableItem {
/// Updates the order of the item to the specified index
func updateOrder(to index: Int)
}
/// Extension to make Split conform to OrderableItem
extension Split: OrderableItem {
func updateOrder(to index: Int) {
self.order = index
}
}
/// Extension to make SplitExerciseAssignment conform to OrderableItem
extension SplitExerciseAssignment: OrderableItem {
func updateOrder(to index: Int) {
self.order = index
}
}

View File

@ -1,6 +1,7 @@
import Foundation
import SwiftData
import SwiftUI
import UniformTypeIdentifiers
@Model
final class Split {
@ -53,6 +54,16 @@ extension Split: EditableEntity {
}
}
// MARK: - Identifiable Conformance
extension Split: Identifiable {
public var id: String {
// Use the name as a unique identifier for the split
// This is sufficient for UI purposes
return self.name
}
}
// MARK: - Private Form View
fileprivate struct SplitFormView: View {