Skip to content

Data backing#302

Open
johankool wants to merge 15 commits into
pointfreeco:mainfrom
johankool:feature/data-backing
Open

Data backing#302
johankool wants to merge 15 commits into
pointfreeco:mainfrom
johankool:feature/data-backing

Conversation

@johankool

@johankool johankool commented Nov 21, 2025

Copy link
Copy Markdown
Contributor

Regarding this message on Slack and this discussion: could this be an approach you would consider to be able to customize wether a column is stored as Data in CloudKit or as a CKAsset?

@mbrandonw

Copy link
Copy Markdown
Member

Hi @johankool, thanks for exploring this. We will chat about this approach, but by far the most dangerous part as it stands right now is that if you switch a column from .inline to .asset (or vice versa) after having deployed your app, then the next update of your app will crash. CKRecords emit an immediate crash if you try to set a key in both the unencrypted and encrypted values.

@stephencelis

Copy link
Copy Markdown
Member

@johankool We chatted about this today and still think the automatic approach mentioned in #281 is the way to go. We could start with an arbitrary, hard-coded threshold (10kb? 16?) and then could explore further configuration/behavior in the future.

This approach would hopefully minimize the additional API surface area and folks could benefit with minimal configuration.

Are you open to updating this PR with this alternate approach?

@johankool
johankool force-pushed the feature/data-backing branch from c03e962 to 57dfa6a Compare November 25, 2025 20:20
@johankool

Copy link
Copy Markdown
Contributor Author

Still needs some more testing, both writing unit tests and actually trying it out in a real app.

Comment thread Sources/SQLiteData/CloudKit/CloudKit+StructuredQueries.swift
@johankool
johankool force-pushed the feature/data-backing branch from ef27e1e to 7556ea9 Compare February 17, 2026 23:33
┌──────────────────────────────────
│ RemindersListAsset(
│ remindersListID: 1,
│ coverImage: Data(16,811 bytes) │

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Need to fix this in CustomDump: on machines with a thousands separator that is not a comma this test fails.

@johankool johankool Apr 3, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

A fix is proposed here: pointfreeco/swift-custom-dump#163

@johankool
johankool marked this pull request as ready for review April 3, 2026 23:13
@johankool johankool changed the title Data backing POC Data backing Apr 3, 2026
@johankool
johankool requested a review from stephencelis July 13, 2026 22:37
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