Should Core Data Stack inherit from NSObject and why? <p>Recently it is practice to move the core data stack implementation from the app delegate to a different class. In most implementations I see that the core data stack inherits from NSObject, even in Apple's documentation. </p> <ol> <li>Is there a reason for that? It seems to work without it.</li> <li>Why is Apple's init method not calling super.init() isn't it a must have?</li> </ol> <p></p> <pre><code>import UIKit import CoreData class DataController: NSObject { var managedObjectContext: NSManagedObjectContext init() { // This resource is the same name as your xcdatamodeld contained in your project. guard let modelURL = NSBundle.mainBundle().URLForResource("DataModel", withExtension:"momd") else { fatalError("Error loading model from bundle") } // The managed object model for the application. It is a fatal error for the application not to be able to find and load its model. guard let mom = NSManagedObjectModel(contentsOfURL: modelURL) else { fatalError("Error initializing mom from: \(modelURL)") } let psc = NSPersistentStoreCoordinator(managedObjectModel: mom) managedObjectContext = NSManagedObjectContext(concurrencyType: .MainQueueConcurrencyType) managedObjectContext.persistentStoreCoordinator = psc dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0)) { let urls = NSFileManager.defaultManager().URLsForDirectory(.DocumentDirectory, inDomains: .UserDomainMask) let docURL = urls[urls.endIndex-1] /* The directory the application uses to store the Core Data store file. This code uses a file named "DataModel.sqlite" in the application's documents directory. */ let storeURL = docURL.URLByAppendingPathComponent("DataModel.sqlite") do { try psc.addPersistentStoreWithType(NSSQLiteStoreType, configuration: nil, URL: storeURL, options: nil) } catch { fatalError("Error migrating store: \(error)") } } } } </code></pre> <p><a href="https://developer.apple.com/library/ios/documentation/Cocoa/Conceptual/CoreData/InitializingtheCoreDataStack.html#//apple_ref/doc/uid/TP40001075-CH4-SW1" rel="nofollow">Initializing the Core Data Stack</a></p>