Skip to content

Conversation

@mbrandonw
Copy link
Member

We can emulate iCloud sharing in previews by making some updates to our mocks that power the sync engine.

@mbrandonw mbrandonw requested a review from stephencelis January 9, 2026 22:13

struct CountersListView: View {
@FetchAll var counters: [Counter]
@FetchAll(
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated the CloudKitDemo to show an icon next to counters that are shared. We can now explore that functionality in previews thanks to the changes in this PR.

package let databaseScope: CKDatabase.Scope
let _container = IsolatedWeakVar<MockCloudContainer>()
let dataManager = Dependency(\.dataManager)
let deletedRecords = LockIsolated<[(CKRecord.ID, CKRecord.RecordType)]>([])
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We keep track of records deleted from the mock cloud database so that when fetching changes we can fetch deletions.

syncEngine: syncEngine
)
} else {
Form {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We now emulate a cloud sharing view in previews!

Base automatically changed from fix-previews to main January 10, 2026 00:00
@mbrandonw
Copy link
Member Author

I scaled this PR back a bit since we went with a simpler model for emulating automatic sync in previews.

@mbrandonw mbrandonw merged commit 521a60e into main Jan 14, 2026
5 checks passed
@mbrandonw mbrandonw deleted the better-preview-sharing branch January 14, 2026 17:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants