Commit 772cadd
feat(sync): CloudKit sync status indicator + crisper card hover (#21)
## Summary
- Adds a small CloudKit sync status indicator to the `TossesView`
toolbar (principal on macOS, top-leading on iOS). Shows a spinner while
`.import`/`.export` events are in flight and an `exclamationmark.icloud`
icon with a tooltip on error, auto-clearing on the next successful
event. `.setup` events are filtered so cold launches don't spin.
- Implemented via a new `@MainActor` `CloudSyncMonitor` in `TossKit`
that subscribes to
`NSPersistentCloudKitContainer.eventChangedNotification` — the
Apple-documented path for observing sync in a SwiftData + CloudKit stack
(SwiftData's `ModelContainer` is still backed by
`NSPersistentCloudKitContainer` and posts this notification globally).
- The indicator uses a fixed 18pt frame so the toolbar never reflows
between idle and syncing, and opts out of the macOS/iOS 26 shared Liquid
Glass background via `.sharedBackgroundVisibility(.hidden)` (gated with
`#available` for older OSes).
- Replaces the 0.5% `scaleEffect` hover feedback on `TossCard` with a
stronger shadow, an inner accent-colored border overlay, and a
pointing-hand cursor. The fractional scale was forcing subpixel
resampling and making the card look faintly blurry on hover.
## Why
CloudKit sync is currently invisible to the user — when it silently
broke recently (iOS↔macOS CloudKit environment mismatch) there was no
signal at all. Apple's own guidance is that event notifications describe
*activity*, not definitive "fully synced" truth, so the UX is
deliberately minimal: transient spinner only, auto-clearing error icon,
nothing persistent, no "last synced at X" text.
## Test plan
- [ ] Launch on macOS; toolbar looks unchanged at idle (no bezel, no
empty slot).
- [ ] Add a toss on the Mac; spinner appears briefly in the toolbar
between "Tosses" and `+`, then disappears.
- [ ] Add a toss on a second device on the same iCloud account; first
Mac shows a spinner when the `.import` event arrives and the toss
appears in the list.
- [ ] Sign out of iCloud, add a toss; orange `exclamationmark.icloud`
shows with tooltip. Sign back in and add another toss; icon auto-clears.
- [ ] Cold-launch several times; no spinner during `.setup` (filtered).
- [ ] Hover a toss card on macOS; border + shadow + cursor change, no
blur.
- [ ] Build on iOS — `.topBarLeading` placement looks correct.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent 44c8895 commit 772cadd
4 files changed
Lines changed: 118 additions & 4 deletions
File tree
- Packages/TossKit/Sources/TossKit/Persistence
- toss
- Views/Tosses
Lines changed: 55 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
30 | 35 | | |
31 | 36 | | |
32 | | - | |
33 | | - | |
34 | | - | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
35 | 40 | | |
36 | | - | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
37 | 48 | | |
38 | 49 | | |
39 | 50 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
23 | 24 | | |
24 | 25 | | |
25 | 26 | | |
| |||
85 | 86 | | |
86 | 87 | | |
87 | 88 | | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
88 | 99 | | |
89 | 100 | | |
90 | 101 | | |
| |||
93 | 104 | | |
94 | 105 | | |
95 | 106 | | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
96 | 117 | | |
97 | 118 | | |
98 | 119 | | |
| |||
183 | 204 | | |
184 | 205 | | |
185 | 206 | | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
17 | 18 | | |
18 | 19 | | |
19 | 20 | | |
| |||
40 | 41 | | |
41 | 42 | | |
42 | 43 | | |
| 44 | + | |
43 | 45 | | |
44 | 46 | | |
| 47 | + | |
45 | 48 | | |
46 | 49 | | |
47 | 50 | | |
| |||
0 commit comments