comparison Simoleon/Persistence.swift @ 182:ba3ebe8cefe5

refactor code
author Dennis Concepcion Martin <dennisconcepcionmartin@gmail.com>
date Wed, 08 Dec 2021 10:58:15 +0100
parents 5a9430fd6b4d
children 9f044d33d8ac
comparison
equal deleted inserted replaced
181:5a9430fd6b4d 182:ba3ebe8cefe5
1 // 1 //
2 // Persistence.swift 2 // Persistence.swift
3 // simoleon 3 // Simoleon
4 // 4 //
5 // Created by Dennis Concepción Martín on 8/12/21. 5 // Created by Dennis Concepción Martín on 8/12/21.
6 // 6 //
7 7
8 import CoreData 8 import CoreData
29 }() 29 }()
30 30
31 let container: NSPersistentCloudKitContainer 31 let container: NSPersistentCloudKitContainer
32 32
33 init(inMemory: Bool = false) { 33 init(inMemory: Bool = false) {
34 container = NSPersistentCloudKitContainer(name: "simoleon") 34 container = NSPersistentCloudKitContainer(name: "Simoleon")
35 if inMemory { 35 if inMemory {
36 container.persistentStoreDescriptions.first!.url = URL(fileURLWithPath: "/dev/null") 36 container.persistentStoreDescriptions.first!.url = URL(fileURLWithPath: "/dev/null")
37 } 37 }
38 container.loadPersistentStores(completionHandler: { (storeDescription, error) in 38 container.loadPersistentStores(completionHandler: { (storeDescription, error) in
39 if let error = error as NSError? { 39 if let error = error as NSError? {