The first edition of Core Data by Marcus Zarra was the book I turned to when I wanted to learn Core Data. Whilst it is still a great book it was. Threading in today’s Core Data is radically different from its original In this talk from #Pragma Conference , Marcus Zarra presents the. Core Data in Swift. by Marcus S. Zarra. Publisher: Pragmatic Bookshelf. Release Date: June ISBN: View table of contents. Start reading.

Author: Faumuro Arashilmaran
Country: Czech Republic
Language: English (Spanish)
Genre: Environment
Published (Last): 1 May 2010
Pages: 136
PDF File Size: 19.82 Mb
ePub File Size: 9.80 Mb
ISBN: 900-2-53596-865-7
Downloads: 41018
Price: Free* [*Free Regsitration Required]
Uploader: Arajinn

Cocoa Is My Girlfriend | Taglines are for Windows programmers

When the call succeeds we now have all of the street addresses in the streetAddresses array:. If I have 10 of them in memory in a pool for me to be able to reuse, they will get out of sync very quickly. The reason for this is because data changes only go up, not down or sideways. User interface is not going to come from any other thread, because the user interface is single threaded.

Of course, Apple would preserve that, right? Marcks focuses on Swift and adds an additional chapter on how to integrate Core Data with an efficient network implementation, with best practices on how to load and pre-load data into your Swift application.

That is not its purpose. The long history of Core Ddata has lent itself to different interpretations over the years about how threading should be used, so how should it be done now? Threading is even trickier than the first version.

The growing army of iOS developers has had an impact:. This is an error that can only happen during testing and therefore is safe with just a ZAssert. By professional developers for professional developers. To begin with, we make sure the context has not already been initialized to prevent accidentally destroying an existing context. This is a rare situation since we test completely, right? The slight decrease in speed tends to hang up a lot of people, which baffles me.


It would just be a waste of cycles. Lists with This Book. It is code that I can look at with a cup of coffee, and understand it before I finish the cup of coffee. On the other hand if you have been using Core Data for a while you can jump straight to the chapters on migrations, performance and threading and learn something. Jordan Carney rated it liked it Mar 06, In my playing and working with Realm, I find that the amount of code you write is about equal.

My Core Data Stack

We had no way to confirm or deny whether we got a threading rule right. I hope this will make clear what has to be done in order to harness this powerful feature of Core Data. That wrapper is a great place to handle migrations, importing, exporting, convenience methods for accessing data; the list goes on. Given an array of dictionaries like this, you can see how that is providing pretty much what we used to get from valueForKeyPath:.

We have to do a bit more dancing to get that right. The main queue is also known as the user interface queue.

Core Data in Swift

In the class continuation we allow the Application Delegate to write to the -persistenceController and we define the method that our callback is going to be using. Use Core Data as a local cache I agree with the wording of this rule but I suspect the meaning is different. The harder your code is to write the harder it is going to be to maintain and coore.

Books fore Marcus S. This website uses cookies for account and order processing. Be clever or lazy and you are only punishing yourself and your users. What about if you should have two child contexts which should share changes between themselves? In most cases this is the only place you need to call save on the main and private contexts.


When I need to process a tremendous amount of data into the Core Data stack and that data can be isolated away from the User Interface. Zarra has spoken at numerous conferences around the globe and has taught Objective-C at top U. They can be messy that way. InitCallbackBlock callback ; – void save.

We build this as a private queue because we specifically want it to be asynchronous from the UI. That is the area of using Core Data in a multi-threaded environment. I was wondering, when you save your child MOC, should the save event propagate to main context so it eventually gets saved to persistent store? Jon Ensminger rated it really liked it Dec 13, Marcus Zarra Marcus Zarra is best known for his expertise with Core Data, persistence, and networking.

My Core Data Stack

They brought me in for three weeks because their main developer was going on vacation for three weeks, and they were shipping in two weeks. The treatment of migrations covers both lightweight and heavy migrations with sufficient detail to understand why heavy migrations can be a headache.

It deserves a proper controller of its own. Once the main context has saved then we move on to the private queue. We want to avoid locking the UI as much as possible because of the persistence layer. In my opinion the book real I wanted to like this more than it turned out I did. The user interface is our truth. Assuming that the developer gave us a callback block, we then execute it on the main thread.