Core Data Mastery in SwiftUI Progress

Mark Moeykens
Jun 27, 2022
Hello everyone,

I wanted to post an update on the Core Data Mastery in SwiftUI book.

I would say I'm probably... half done. The book is currently at 250 pages and I have a few beta readers giving me feedback as I try to regularly release new chapters.

The chapter I'm currently working on has been...challenging.

What is the next chapter?


Yes, concurrency is the next chapter. And this chapter has undergone probably 8 different revisions so far.

I have restructured it many times to get the progression right.

Now, I could have done this whole chapter in 2 pages, really. "Here's some code. Just do this."

I've read a few books on this topic in Core Data and many, many posts and documentation in this area and watched probably every WWDC video related to this....a few times.

But I get this nagging feeling in my brain. That unsatisfied feeling that 2 pages don't really explain HOW these two functions and their variations in Core Data work.

Deep Dive

Albert Einstein said, "If you can't explain it simply, you don't understand it well enough."

Well, I say, "If you can't SHOW it simply, you don't understand it well enough."

And as I tried to show every aspect of concurrency, I found I couldn't show some parts of it simply. And I have access to some Apple employees and reached out to them, and they couldn't explain/show it simply. And my friends and community could not either.

I had to find a way to resolve this confusion that was preventing me from being able to show something simply. It was very frustrating! I wanted to go back to just using those 2 pages and call it good. But I would simply be doing to you what was done to me.

Last week I had a breakthrough though!

I finally figured out the missing piece and realized I was looking at it wrong. And as I started drawing diagram after diagram, other misconceptions also appeared revealing I didn't understand everything well enough.

Well, I'm happy to say I can finally SHOW concurrency in Core Data...simply.

Concurrency Mastery

Concurrency Mastery is another book that I started last year and so I added a lot of my notes there. Don't worry, I'm not switching gears to write that book now. But I do have more of a solid foundation on everything, now that it can be shown visually.

It was difficult to know where to draw the line between how much concurrency I should be teaching and how much of it in Core Data. 

I think I have a good balance now. 

And I think you're going to like where I'm going. I'm 28 pages into this chapter right now and have a little bit more to go.

Concurrency in Core Data

So, here are just a few things you will be learning once this chapter is finished:
  • What is a queue?
  • What are the two types of queues and which one does Core Data use and why?
  • What is a thread and how do they relate to queues?
  • How do you use Xcode to see not only the threads but the type of queue it's using?
  • What are the two rules of Core Data and threads?
  • What is the right and wrong way to use threads in Core Data?
  • How can Xcode help you find out if you have a thread problem?
  • How do I use Xcode to verify if the problem is fixed or not?
  • How can I use the perform function to fix these problems and follow the 2 rules of Core Data and threads?
  • What are sync, async, and parallelism?
  • And what do they look like?
  • How do they relate to Core Data?
  • What causes your UI to freeze and become unresponsive when using Core Data?
  • How can you use the Task object to help follow the 2 rules of Core Data and threads?

And there's more to do as I'll also be getting into async and await and background operations. But don't be scared. You're going to be seeing a LOT of pictures repeatedly so that you'll get it.

Hopefully, I'll get more time to work on it this week and coming weekend!

Your SwiftUI friend,
Mark Moeykens

PS - Don't forget that you can get the free Core Data Quick Start in SwiftUI book now. This will teach you just enough to get started with Core Data in SwiftUI.
I'm not sure if I'll keep this Quick Start version around after I release the Mastery book.


Jun 30, 2022
Hi Mark, I'm really looking forward to this book, from what I've read so far, it is solidifying my understanding of Core Data. Something you may, or may not know, but I came across this when I switched to using @FetchRequest and @SectionFetchRequest; you need to treat these as viewModels and place an @ObservedObject where you're displaying the data. see Maybe you could clarify how this should work in your book.

Mark Moeykens
Jul 2, 2022
Hi Theo! 
Oh wow, that's interesting! Thanks for the heads up, I'll make an example for the book!