Comments (2)
Similar to your question #9 — this is for two reasons: (A) threading reasons. The init
code may not run on the thread that the SyncCoordinator
should use. Secondly, an explicit call to setup
allows us to create the SyncCoordinator
, do additional configuration (e.g. setting a delegate) and only then trigger the setup
. In the trivial example code that's not needed, but we still wanted to show that pattern.
It’s probably overwhelming, but you may want to take a look at https://github.com/wireapp/zmessaging-cocoa — it uses a similar architecture.
from core-data.
Does the Moody sample app actually require that the setup methods be called on the sync MOC's thread (using performGroupedBlock
), or is this again just an illustration of a best practice?
Thanks for your answers --- I had the vague idea it was "for doing things safer while using multiple threads", but I just haven't yet found a resource that has allowed me to understand what the specific dangers are and when one encounters them. For example, in the case that my app only ever has one SyncCoordinator
, is all of this a bit overkill, demonstrating best multi-threaded practices but not actually necessary? Do I only need to worry about this sort of stuff if I have less control over how my SyncCoordinator
is used?
from core-data.
Related Issues (20)
- cant't compiler HOT 8
- naming issue, "performGroupedBlock" actually performs no block HOT 1
- Fragility of using ubiquityToken? HOT 1
- Question: Confused with one place in SyncCoordinator
- Opening `.omo` file directly considered harmful HOT 3
- does this book has OC(not swift) version? HOT 1
- Initial ViewController Loading twice? HOT 1
- Xcode 9+ NSManagedObject Auto Class Generation HOT 1
- Xcode 9.2, Swift 4 Compile Errors HOT 1
- Crash when update last row
- NSPersistentContainer background context merge changes HOT 2
- Update fails if the cell is not visible
- Xcode 9.3, swift 4.1 compile error HOT 2
- Why is notifyAboutChangedObjects called when sync context did save? HOT 1
- Utilities.swift Binary Operator Error HOT 2
- Build error "Switch must be exhaustive" in file CloudKit+Sync.swift
- CoreData Error: Invalid generation token: this persistent store coordinator does not have any of the referenced stores
- Do you have a plan to update Swift 5.1 with Combine?
- how to set primaryKey HOT 3
- fatalError("Returned multiple objects, expected max 1") HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from core-data.