31 lines
686 B
Swift
31 lines
686 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 = index
|
|
}
|
|
}
|
|
|
|
/// Extension to make SplitExerciseAssignment conform to OrderableItem
|
|
extension Exercise: OrderableItem {
|
|
func updateOrder(to index: Int) {
|
|
self.order = index
|
|
}
|
|
}
|