Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add a Storage Provider that works against an iOS or macOS provided fileURL #97

Open
heckj opened this issue May 14, 2024 · 2 comments
Open
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@heckj
Copy link
Collaborator

heckj commented May 14, 2024

Add a built-in storage provider that is initialized with a fileURL, to accomodate the following use cases:

  • a fileURL provided by NSDocument, UIDocument, or SwiftUI document-based APIs that points to a location on disk (for example, .fileImporter that returns a fileURL that then needs to be accessed as a security scoped URL - .startAccessingSecurityScopedResource())
  • (This might be same as above, but a URL bookmark that was shared - https://developer.apple.com/documentation/security/app_sandbox/accessing_files_from_the_macos_app_sandbox)
  • a constant or indicator that the storage provider should use the App's sandboxed Documents location
  • an App Group container URL
@heckj heckj added enhancement New feature or request help wanted Extra attention is needed labels May 14, 2024
@jessegrosjean
Copy link
Contributor

I'm not sure if this would be right for the default file storage provider, but I've been playing with making NSDocument write to a bundle format using the general design suggested here for CloudKit .

The nice feature of this is that the format should then automatically merge. So for example you can share this on iCloud Drive and concurrent edits should converge.

Except my version seems to have bugs that I'm still figuring out :) Anyway, don't have anything fully working to share yet, just wanted to add this note for possible future implementation.

@heckj
Copy link
Collaborator Author

heckj commented May 18, 2024

If you want to lift the logic, there's an implementation of the "partial incremental changes"/"compacted changes" in parallel in the DocumentStorage class of the repo - Following the JS impl, it was meant to ride about the provider, which is only concerned with shifting bytes onto, and off of, disk given various prefixes (used to determine locations)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants