automerge/automerge-swift
소개
Swift language bindings presenting Automerge
개발 도구측정된 스타 증가
- in 24h
- 0
- in 7 days
- 0
- in 15 days
- 0
- in 1 month
- 기록 수집 중
서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.
README.md
OriginalAutomerge-swift
The project is an Automerge implementation, a library of data structures for building collaboraative applications, in Swift. Automerge is cross platform and cross-language, allowing you to provide collaboration support between browsers and native apps.
The API Documentation provides an overview of this library and how to use it.
Automerge Repo (Swift) is a supplemental library that extends this library. It adds pluggable network and storage support for Apple platforms for a more "batteries included" result, and is tested with the JavaScript version of Automerge Repo.
The open-source iOS and macOS document-based SwiftUI App MeetingNotes provides a show-case for how to use Automerge to build a live, collaborative experience. MeetingNotes builds over both this library and the repository to provide both WebSocket and peer to peer based networking in the app.
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.
Note: There was an earlier project that provided Swift language bindings for Automerge. The repository was renamed and archived, but is available if you are looking for it.
관련 프로젝트 살펴보기
불러오는 중…