init
This commit is contained in:
26
Werkout_ios/Models/Workout.swift
Normal file
26
Werkout_ios/Models/Workout.swift
Normal file
@@ -0,0 +1,26 @@
|
||||
//
|
||||
// Workout.swift
|
||||
// Werkout_ios
|
||||
//
|
||||
// Created by Trey Tartt on 6/14/23.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
struct Workout: Codable {
|
||||
let name: String
|
||||
let description: String?
|
||||
let exercises: [ExerciseElement]
|
||||
let registeredUser: [RegisteredUser]
|
||||
|
||||
enum CodingKeys: String, CodingKey {
|
||||
case name, description, exercises
|
||||
case registeredUser = "registered_user"
|
||||
}
|
||||
|
||||
var exercisesSortedByCreated_at: [ExerciseElement] {
|
||||
return self.exercises.sorted(by: {
|
||||
$0.createdAtDate < $1.createdAtDate
|
||||
})
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user