Give your simulator superpowers

RocketSim: An Essential Developer Tool
as recommended by Apple

Win a ticket for the Do iOS Conference in Amsterdam Join here.

How to observe NSManagedObject changes in Core Data using Combine

Observing changes in Core Data NSManagedObject instances with Combine publishers can be a great solution to keep your user interface in sync with the latest changes. After reading through my posts in the Combine and Core Data categories, you might know more about those individual frameworks, but how do you ...
CombineCore Data

Data validation on insertion, update, and deletion in Core Data

Data validation in apps is important to make sure we save data conforming to the business rules. A name should be of a certain length and can't contain invalid characters. It's tempting to write all this logic in a new "Validator" class while we do a lot of this directly ...
Core Data

Derived Attributes to improve Core Data Fetch Performance

Derived attributes are available since iOS 13 and aim to improve fetch performance in many different scenarios. Although we have great performance with the latest devices it's good to be prepared for scaling up to fetching a large number of items from your database. Your memory footprint might look good ...
Core Data

Constraints in Core Data Entities explained

Constraints in Core Data are part of an entity configuration. Settings like the entity name and Spotlight display name might be easy to understand while constraints are a bit less known. However, they can be super useful to maintain a unique set of data. Constraints can take away the need ...
Core DataSwift

NSManagedObject events: handling state in Core Data

An NSManagedObject lifecycle goes from insertion and updates until deletion in the end. All those events come with their own common related modifications and can be used in many different ways. Managing state in Core Data from within the NSManagedObject class itself is a great way to keep logic centralized ...
Core DataSwift

How-to use Diffable Data Sources with Core Data

Diffable Data Sources were introduced at WWDC 2019 as a replacement for UICollectionViewDataSource and UITableViewDataSource. The API is available on iOS 13 and up and makes it easy to set up lists of data in which changes are managed through so-called snapshots. The Core Data team added new delegate methods ...
Core DataSwift

Persistent History Tracking in Core Data

WWDC 2017 introduced a new concept available from iOS 11 which is persistent history tracking. It's Apple's answer for merging changes that come from several targets like app extensions. Whenever you change something in your Core Data database from your Share Extension, a transaction is written which can be merged ...
Core DataSwift

Write-Ahead Logging (WAL) disabled to force commits in Core Data

Write-Ahead Logging is the default journaling mode for Core Data SQLite stores since iOS 7 and OS X Mavericks. Journaling in Core Data is best explained as the way data transactions are saved into the underlying SQLite store. The WAL mode is significantly faster in most scenarios compared to the ...
Core DataSwift

ValueTransformer in Core Data explained: Storing absolute URLs

ValueTransformers in Core Data are a powerful way of transforming values before they get inserted into the database and before they get read. They're set up in an abstract class which handles the value transformations from one representation to another. They're often used as a way to store values that ...
Core DataSwift

Core Data Performance: 6 tips you should know

Writing Core Data code with performance in mind helps to prepare your app for the future. Your database might be small in the beginning but can easily grow, resulting in slow queries and decreased experience for the user. Since I started writing the Collect by WeTransfer app in 2017 I've ...
Core DataSwift

NSFetchedResultsController extension to observe relationship changes

Apple provides us with great classes like the NSFetchedResultsController to interact with Core Data databases in our apps. The API evolved over the years with additions like support for the new NSDiffableDataSource. However, there are still scenarios where the default API is not helping enough. At WeTransfer, we heavily make ...
Core DataSwift