automerge / automerge-swift

Swift language bindings presenting Automerge
https://automerge.org/automerge-swift/documentation/automerge/
MIT License
233 stars 13 forks source link

AutomergeText quick use case #100

Closed heckj closed 5 months ago

heckj commented 8 months ago

AutomergeText is meant to work with the encoding/decoding setup, but that implies a heavier document structure than may be warranted in some cases. It would be nice to have an option to set up an AutomergeText instance on a document where the creation of the AutomergeText instance would also immediately create the relevant structure in the document, if the structure wasn't already in place. If the document already has structure where AutomergeText is attempting to be created, it should throw an error or fail initialization - haven't thought throw the call site usage on that point.

Currently you need to:

  1. create the Automerge document
  2. establish the schema into the document (either directly, or by encoding a structure into it)
  3. then establish AutomergeText so that it binds to the schema you created.

Even more optimized might be creating a document as well as the structure, so that you've got a one-shot setup for a document with a single text instance for collaborating editing of that text value.