iOS-Interview-Questions
iOS-Interview-Questions copied to clipboard
Add to "Core Data" a Section on "Type Safety && Concurrency"
A question I have been asked in interview is about whether Core Data typesafe, and how to manage concurrency with Core Data... A simple answer being that Core Data is not typesafe, whilst one may use different queues, with Core Data "Core Data expects to be run on a single thread." (https://cocoacasts.com/core-data-and-concurrency/). You could put different NSManageObjectContext(s) into your app, but you can't share managed object contexts between threads. With the answer you might also want to cover the: three concurrency types , mainQueueConcurrencyType, confinementConcurrencyType, privateQueueConcurrencyType for an NSManagedObjectContext.