We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 3c53890 commit e0edbb1Copy full SHA for e0edbb1
1 file changed
AnimalsApp/AnimalsApp/Services/CoreData.swift
@@ -17,13 +17,21 @@ protocol CoreDataContract: AnyObject {
17
func saveChanges()
18
}
19
20
+protocol UpdateDelegateProtocol: AnyObject {
21
+ func updateFavoriteAnimals()
22
+}
23
+
24
class CoreData: CoreDataContract {
25
static let shared = CoreData()
26
27
private var managedContext: NSManagedObjectContext?
28
29
+ var delegate: [UpdateDelegateProtocol]?
30
var favoriteAnimals = [FavoriteAnimal]() {
31
didSet {
- //completar
32
+ delegate?.forEach { delegate in
33
+ delegate.updateFavoriteAnimals()
34
+ }
35
36
37
0 commit comments