This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if let appDelegate = UIApplication.shared.delegate as? AppDelegate { | |
let managedContext = appDelegate.persistentContainer.viewContext | |
if let customer: Customer = NSEntityDescription.insertNewObject(forEntityName: "Customer", into: managedContext) as? Customer { | |
customer.name = "Mike" | |
//stuff | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
import CoreData | |
//MARK: - Core Data stack | |
class CoreDataStack: NSObject { | |
static let sharedInstance = CoreDataStack() | |
static let containerName = "CoreDataExample" //CoreDataExample.xcdatamodeld | |
private override init() {} |
NewerOlder