{"id":15114,"date":"2016-07-07T13:49:51","date_gmt":"2016-07-07T17:49:51","guid":{"rendered":"http:\/\/mjtsai.com\/blog\/?p=15114"},"modified":"2016-07-07T14:01:48","modified_gmt":"2016-07-07T18:01:48","slug":"concurrent-core-data-now-easier-than-ever","status":"publish","type":"post","link":"https:\/\/mjtsai.com\/blog\/2016\/07\/07\/concurrent-core-data-now-easier-than-ever\/","title":{"rendered":"Concurrent Core Data, Now Easier Than Ever"},"content":{"rendered":"<p><a href=\"http:\/\/holko.pl\/2016\/06\/23\/core-data\/\">Arkadiusz Holko<\/a>:<\/p>\n<blockquote cite=\"http:\/\/holko.pl\/2016\/06\/23\/core-data\/\">\n<p>Our main thread-bounded operations use <code>viewContext<\/code>. Background work can be performed on a context returned by the factory method <code>newBackgroundContext()<\/code>. However, usage of <code>performBackgroundTask(_:)<\/code> is recommended because of the under-the-hood optimizations.<\/p>\n<p>All contexts are independent of each other, there are no parent\/child relationships here. To receive changes from other contexts we simply set <code>automaticallyMergesChangesFromParent<\/code> flag to <code>true<\/code> on a context. Despite its name (<code>*FromParent*<\/code>), it works correctly with the <code>NSPersistentContainer<\/code> setup in which contexts are siblings:<\/p>\n<\/blockquote>\n<p>Not sure I understand that last bit.<\/p>\n<p>Update (2016-07-07): <a href=\"https:\/\/twitter.com\/jpohh\/status\/751111849593147392\">James O&rsquo;Leary<\/a> says that, despite the name of the property, it treats the persistent store itself as an implicit parent context.<\/p>","protected":false},"excerpt":{"rendered":"<p>Arkadiusz Holko: Our main thread-bounded operations use viewContext. Background work can be performed on a context returned by the factory method newBackgroundContext(). However, usage of performBackgroundTask(_:) is recommended because of the under-the-hood optimizations. All contexts are independent of each other, there are no parent\/child relationships here. To receive changes from other contexts we simply set [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"apple_news_api_created_at":"","apple_news_api_id":"","apple_news_api_modified_at":"","apple_news_api_revision":"","apple_news_api_share_url":"","apple_news_coverimage":0,"apple_news_coverimage_caption":"","apple_news_is_hidden":false,"apple_news_is_paid":false,"apple_news_is_preview":false,"apple_news_is_sponsored":false,"apple_news_maturity_rating":"","apple_news_metadata":"\"\"","apple_news_pullquote":"","apple_news_pullquote_position":"","apple_news_slug":"","apple_news_sections":"\"\"","apple_news_suppress_video_url":false,"apple_news_use_image_component":false,"footnotes":""},"categories":[4],"tags":[800,109,31,1380,30,1381,71],"class_list":["post-15114","post","type-post","status-publish","format-standard","hentry","category-programming-category","tag-concurrency","tag-coredata","tag-ios","tag-ios-10","tag-mac","tag-macos-10-12","tag-programming"],"apple_news_notices":[],"_links":{"self":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/15114","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/comments?post=15114"}],"version-history":[{"count":3,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/15114\/revisions"}],"predecessor-version":[{"id":15123,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/15114\/revisions\/15123"}],"wp:attachment":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/media?parent=15114"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/categories?post=15114"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/tags?post=15114"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}