sync

CloudKit for iCloud sync

CloudKit syncs app data across a user's devices via iCloud. Public databases share data with all users, private databases store user-specific data, and shared databases enable collaboration. I define record types with fields in the CloudKit Dashboard,

Lazy init of expensive clients with sync.Once

Some dependencies are expensive to initialize (TLS-heavy clients, large config loads, SDKs that fetch metadata). I use sync.Once to ensure initialization happens exactly once, even under concurrent access. The important detail is capturing the initial