Using an Existing SQLite Store with NSPersistentContainer

If you’ve been creating the Core Data Stack without NSPersistentContainer and you’re thinking about switching things up to use NSPersistentContainer, you need to think about your existing SQLite persistent store. Creating the stack with NSPersistentContainer handles the creation of SQLite stores internally, so brand new setups using NSPersistentContainer are pretty easy. But how do you […]

Why is it called a “Closure” anyway? A Swift Conceptual Look.

Bottle with cork

What’s in a name? If a programming language comes with a named feature, you can be pretty sure it was named that way for a reason. It’s a safe bet that the language designers were purposeful in their naming, so if you can figure out that essential “Why’d they name it that?” question, you might […]

A Swift Implementation of the Core Data Stack Using NSPersistentContainer

If you’re targeting iOS 10 and above, you’ve got the opportunity to pick your poison when it comes to creating the Core Data stack. You could opt for the process I described in Creating the Core Data Stack with Backwards Compatibility in Swift — that process still works perfectly fine in iOS 10+. Alternatively, you […]

Why Do We Need to Annotate Escaping Closures in Swift?

Why Do We Need to Annotate Escaping Closures?

My last entry on escaping closures ended up having way more interaction than I anticipated! It goes to show that you never know what the impact of a piece of writing will have. But that’s a different story… :] Several readers commented here and on Medium with the question, “Why? Why do we need to […]

What in the World is an “Escaping Closure” in Swift?


If you’re mostly in the business of coding up closures to pass off to other functions as callbacks, you may not have run into the concept of an “escaping closure” yet. When you step out of the role of consuming other peoples’ APIs in to the realm of creating your own (and you do this […]

Core Data Model Attributes and NSManagedObject Property Types Must Match!

Jump to… Data model Attributes and NSManagedObject property types – Match ’em! Optionals are Types Lessons learned Was this article helpful? Please share! Learning Core Data? Watch my course, Core Data Fundamentals with Swift! I admit – it might have taken me less time to figure out my runtime exception if I hadn’t just migrated […]

How to Unwrap Multiple Optionals with One If-Let in Swift

What do you do when you’ve got two (or more) optionals that you need to safely unwrap and work with? Code examples Suppose that you’ve got two arrays, both of which are optional. What I want to do right now is walk through a couple of scenarios where I unwrap them at the same time […]

Creating the Core Data Stack with Backwards Compatibility in Swift

In 2017, we live in a world where there are still non-iOS 10 devices out in the wild. If your app is targeting an iOS version earlier than iOS 10, or macOS Sierra (10.12), you’ll be unable to take advantage of Core Data’s latest “stack creation” class called NSPersistentContainer. So what can you do? While […]

Swift Tip – Accessing a User’s Documents Directory with URL Extension

When you need to access the documents directory on a user’s device, what do you do? In the past, I know I’ve gotten used to typing out the same set of code over and over throughout my apps. I know, I know – DRY – don’t repeat yourself. One way to simplify this is to […]

Core Data Fundamentals with Swift

Core Data is an extremely powerful framework for managing and persisting data on your users’ devices. And let’s face it: saving data to your users’ devices is inevitable. The question is, which data management and persistence technology you use when the time comes for you to tackle this challenge? I’ve been hard at work on […]