- Migrate from SwiftData to CoreData with CloudKit sync - Add core models: Split, Exercise, Workout, WorkoutLog - Implement tab-based UI: Workout Logs, Splits, Settings - Add SF Symbols picker for split icons - Add exercise picker filtered by split with exclusion of added exercises - Integrate IndieAbout for settings/about section - Add Yams for YAML exercise definition parsing - Include starter exercise libraries (bodyweight, Planet Fitness) - Add Date extensions for formatting (formattedTime, isSameDay) - Format workout date ranges to show time-only for same-day end dates - Add build number update script - Add app icons
31 lines
685 B
Swift
31 lines
685 B
Swift
//
|
|
// 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 = Int32(index)
|
|
}
|
|
}
|
|
|
|
/// Extension to make Exercise conform to OrderableItem
|
|
extension Exercise: OrderableItem {
|
|
func updateOrder(to index: Int) {
|
|
self.order = Int32(index)
|
|
}
|
|
}
|