automerge / automerge-swift

Swift language bindings presenting Automerge

Home Page:https://automerge.org/automerge-swift/documentation/automerge/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Create a parallel Document that's actor protected, with async methods for updating content

heckj opened this issue · comments

The idea being ultimately replacing the DispatchQueue protection, and shifting to fully embracing swift's async/await structure. With Swift 6 (fully embracing this safety marker) coming this June (2024), we'll want to make sure at a minimum we pass all Sendable checking.

In addition, the more recent updates to UniFFI (2.6.1) have started to embrace coordinating async calls between Rust and Swift. We're not taking advantage of these yet, but it may prove useful down the road.

Since I think we'll want to maintain backward compatibility for a while, a parallel type to Document would make a lot of sense, and we can slowly shift/deprecate the current version as the experiments vet themselves out in practical (app) use.

I guess by using an internal DispatchQueue and conforming to Sendable (maybe unsafe) your are already ready for Swift 6. Not sure if it is worth rewriting everything using actors

@lightsprint09 You're correct - I've verified Automerge-swift is completely good for Swift6 mode already, but in learning more about it, it seems like it may be a good way to also accomplish it, so I wanted to try it out