I would like to create my models for my iOS app using struct as I understand it is the appropriate way to do things. I have the following:
protocol Exercise: Identifiable {
    var id: UUID { get }
    var name: String { get }
    var type: ExerciseType { get }
}
enum ExerciseType {
    case duration
    case reps
    case rest
}
extension Exercise {
    var id: UUID { UUID() }
}
struct DurationExercise: Exercise {
    let name: String
    let durationInSeconds: Int
    let type: ExerciseType = .duration
    
}
struct RepetionsExercise: Exercise {
    let name: String
    let reps: Int
    let type: ExerciseType = .reps
}
struct RestExercise: Exercise {
    let name: String
    let durationInSeconds: Int
    let type: ExerciseType = .rest
}
- Is this extending the proper way to initialize the - id: UUIDusing protocol + structs?
- Is there a way where I don't have to specify the - name: Stringin every struct that inherits- Exercise?
- Or if I want to do something like I should just use - class?