-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRoutine+CoreDataProperties.swift
58 lines (42 loc) · 1.34 KB
/
Routine+CoreDataProperties.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
//
// Routine+CoreDataProperties.swift
// Lift Track
//
// Created by Jack Lingle on 1/22/23.
//
//
import Foundation
import CoreData
extension Routine {
@nonobjc public class func fetchRequest() -> NSFetchRequest<Routine> {
return NSFetchRequest<Routine>(entityName: "Routine")
}
@NSManaged public var id: UUID?
@NSManaged public var title: String?
@NSManaged public var totalSets: Int16
@NSManaged public var totalWorkouts: Int16
@NSManaged public var workouts: NSSet?
public var wrappedTitle: String {
title ?? "New Routine"
}
// returns an array of the workouts to be iterable in for each loop, should only have to add a id for the loop
public var workoutArray: [Workout] {
let set = workouts as? Swift.Set<Workout> ?? []
return set.sorted {
$0.wrappedTitle < $1.wrappedTitle
}
}
}
// MARK: Generated accessors for workouts
extension Routine {
@objc(addWorkoutsObject:)
@NSManaged public func addToWorkouts(_ value: Workout)
@objc(removeWorkoutsObject:)
@NSManaged public func removeFromWorkouts(_ value: Workout)
@objc(addWorkouts:)
@NSManaged public func addToWorkouts(_ values: NSSet)
@objc(removeWorkouts:)
@NSManaged public func removeFromWorkouts(_ values: NSSet)
}
extension Routine : Identifiable {
}