There is probably an infinite number of ways to design a Core Data stack. One mistake that I’ve experienced in the past is nesting contexts like this:
Continue reading “Nested Core Data Contexts Can Block the UI” →Combine: Cancelling Subscriptions Within Sink Closures
I needed to cancel subscriptions (AnyCancellable
) made using sink inside the sink
closure without causing any leakage. It didn’t turn out to be straightforward. We’ll explore how I solved that here.
Deleting Objects During a Core Data Migration
We will explore how to migrate between two Core Data model versions and delete one entity’s objects. We’ll do this using a mapping model and a custom migration policy.
Continue reading “Deleting Objects During a Core Data Migration” →Writing Unit Tests for Core Data Migrations
We’ll explore how we can write unit tests for Core Data migrations. This approach should apply to both lightweight and heavyweight migrations.
Continue reading “Writing Unit Tests for Core Data Migrations” →Using Mirror to Test Private Properties
There may be times when we’d like to evaluate the state of private properties in unit tests. But we’d rather avoid exposing them publicly as this could make the interface difficult to understand. One way to get around this using reflection via Swift’s Mirror
.