Automerge

0.5.15

Swift language bindings presenting Automerge
automerge/automerge-swift

What's New

0.5.15

2024-05-08T16:46:42Z

What's Changed

  • Re-release 0.5.14 with a new hashcode - release 0.5.14 has an invalid binary report
  • updating toolchain for CI runs - to rust 1.75 by @heckj in #170

Full Changelog: 0.5.14...0.5.15

Automerge-swift

An Automerge implementation for swift.

This is a low-level library with few concessions to ergonomics, meant to interact directly with the low-level Automerge API. Additional API that is more ergonomic is being added into the repository as this project evolves.

Automerge-Swift API Documentation is available on the Automerge site. A command-line demonstration application (contaaacts) is available that shows using the lower level API.

Note: There was an earlier Swift language bindings for Automerge here at automerge/automerge-swift. The repository was renamed and archived, but is available if you are looking for it.

Quickstart

Add a dependency in Package.swift, as the following example shows:

let package = Package(
    ...
    dependencies: [
        ...
        .package(url: "https://github.com/automerge/automerge-swift.git", from: "0.5.2")
    ],
    targets: [
        .executableTarget(
            ...
            dependencies: [.product(name: "Automerge", package: "automerge-swift")],
            ...
        )
    ]
)

Now you can create a document and do all sorts of Automerge things with it

let doc = Document()
let list = try! doc.putObject(obj: ObjId.ROOT, key: "colours", ty: .List)
try! doc.insert(obj: list, index: 0, value: .String("blue"))
try! doc.insert(obj: list, index: 1, value: .String("red"))

let doc2 = doc.fork()
try! doc2.insert(obj: list, index: 0, value: .String("green"))

try! doc.delete(obj: list, index: 0)

try! doc.merge(other: doc2) // `doc` now contains {"colours": ["green", "red"]}

For more details on the API, see the Automerge-swift API documentation and the articles within.

Description

  • Swift Tools 5.6.0
View More Packages from this Author

Dependencies

  • None
Last updated: Mon May 13 2024 23:50:54 GMT-0900 (Hawaii-Aleutian Daylight Time)