Skip to content

Commit

Permalink
Update to [email protected], implement marks (#39)
Browse files Browse the repository at this point in the history
* Update to [email protected], implement marks

There are some mechanical changes to the API:

* Allow negative `delete` arguments for `Doc.splice` and
  `Doc.spliceText`
* Add `Doc.mark`, `Doc.marks` and `Doc.marksAt`
* Add the `Mark` and `ExpandMark` types
* Add PatchAction.Conflict and PatchAction.Marks
* Add a `marks` field to `PatchAction.SpliceText` and
  `PatchAction.Insert`

One slightly more significant change is the addition of `unsafe impl
Send{}` and `unsafe impl Sync{}` on the `Doc` we export to uniffi. This
is required because currently `automerge::Automerge` is not `Send` or
`Sync` due to the internal use of an `Rc`. The `unsafe` impls are okay
because we guarantee that all accesses of the document on the Swift side
are from a single thread. In future we should be able to remove the `Rc`
from automerge to make it `Send` again and remove these unsafe impls.

* fix: removes extraneous whitespace `rustfmt` complains about.
* fix: sets LOCAL_BUILD environment variable in CI so that
swift package uses the locally built XCFramework. Thought this was
working, but with errors on the swift file, I think I missed it earlier.
* docs: updates documentation to curate Marks into Document and overall Automerge-Swift documentation

---------

Co-authored-by: Joe Heck <[email protected]>
  • Loading branch information
alexjg and heckj authored Jul 2, 2023
1 parent d448ddd commit a40e37d
Show file tree
Hide file tree
Showing 18 changed files with 1,888 additions and 1,854 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ on: [push]
jobs:
build-test:
runs-on: macos-latest
env:
LOCAL_BUILD: true
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
Expand Down
Loading

0 comments on commit a40e37d

Please sign in to comment.