finds.dev← search

// the find

ggruen/CloudKitSyncMonitor

★ 580 · Swift · MIT · updated Jun 2025

Monitor current state of NSPersistentCloudKitContainer sync

A Swift package that wraps NSPersistentCloudKitContainer's notification spam into @Published properties you can actually use. Solves the real problem that CloudKit can silently stop syncing with no indication to the user or developer. iOS/macOS only, obviously.

Catches the genuinely insidious 'isNotSyncing' case where CloudKit reports the account as available but sync has quietly stalled — this is the bug that bites real users. SwiftUI integration is dead simple: drop in SyncStatusView and you're done. The state enum (notStarted/inProgress/succeeded/failed) maps cleanly onto what you'd want to show in UI. Updated to Swift 6 concurrency as of June 2025, so it won't fight you in modern codebases.

It's a single 580-line file doing everything — if Apple changes the notification names or payloads, the whole thing breaks and you're waiting on a maintainer. No mechanism to distinguish a transient network blip from a real sync failure, so you'll get false 'broken' states on flaky connections. Tests are minimal and don't cover the notification-parsing logic, which is the most fragile part. The singleton pattern (SyncMonitor.default) makes testing your own code against it annoying.

View on GitHub →

// want more like this?

We dig through GitHub every week and send a few repos picked for what you actually care about — each with an honest take like this one.

Get finds in your inbox → Search again →