forked from ADA-ANTIMO/antimo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathActivity+CoreDataProperties.swift
50 lines (40 loc) · 1.16 KB
/
Activity+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
//
// Activity+CoreDataProperties.swift
// Antimo
//
// Created by Bisma Mahendra I Dewa Gede on 10/06/23.
//
//
import SwiftUI
import CoreData
extension Activity {
@nonobjc public class func fetchRequest() -> NSFetchRequest<Activity> {
return NSFetchRequest<Activity>(entityName: "Activity")
}
@NSManaged public var createdAt: Date?
@NSManaged public var id: UUID?
@NSManaged public var image: String?
@NSManaged public var note: String?
@NSManaged public var title: String?
@NSManaged public var type: String?
@NSManaged public var exercise: ExerciseActivity?
@NSManaged public var grooming: GroomingActivity?
@NSManaged public var medication: MedicationActivity?
@NSManaged public var nutrition: NutritionActivity?
@NSManaged public var other: OtherActivity?
}
extension Activity : Identifiable {
}
extension Activity {
var imagePath: String {
image ?? ""
}
var uiImage: UIImage {
if !imagePath.isEmpty,
let image = FileManager().retrieveImage(with: imagePath) {
return image
} else {
return UIImage(systemName: "photo")!
}
}
}