Skip to content

Commit

Permalink
resetting how we invoke bindgen, which solved the linking issues
Browse files Browse the repository at this point in the history
  • Loading branch information
heckj committed Feb 19, 2024
1 parent 3c098d1 commit a412bbe
Show file tree
Hide file tree
Showing 9 changed files with 1,357 additions and 1,079 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ build/
.ffisymbol-graphs
*_identifiers.txt
*_symbols.txt
.vscode

Cargo.lock

Expand Down
112 changes: 56 additions & 56 deletions Snippets/SyncExample.swift
Original file line number Diff line number Diff line change
@@ -1,56 +1,56 @@
// snippet.establishDocuments
import YSwift

let localDocument = YDocument()
let localText = localDocument.getOrCreateText(named: "example")
localDocument.transactSync { txn in
localText.append("hello, world!", in: txn)
}

let remoteDocument = YDocument()
let remoteText = remoteDocument.getOrCreateText(named: "example")
// snippet.end

// snippet.displayTextFromDocuments
localDocument.transactSync { txn in
print("local document text from `example`: \"\(localText.getString(in: txn))\"")
}

remoteDocument.transactSync { txn in
print("remote document text from `example`: \"\(remoteText.getString(in: txn))\"")
}

// snippet.end

// snippet.syncDocuments
print(" --> Synchronizing local to remote")
let remoteState = remoteDocument.transactSync { txn in
txn.transactionStateVector()
}

print(" . Size of the remote state is \(remoteState.count) bytes.")
let updateRemote = localDocument.transactSync { txn in
localDocument.diff(txn: txn, from: remoteState)
}

print(" . Size of the diff from remote state is \(updateRemote.count) bytes.")
remoteDocument.transactSync { txn in
try! txn.transactionApplyUpdate(update: updateRemote)
}

// snippet.end

// Synchronization complete, read out results into local variables

// snippet.captureAndDisplaySyncedData
let localString = localDocument.transactSync { txn in
localText.getString(in: txn)
}

let remoteString = remoteDocument.transactSync { txn in
remoteText.getString(in: txn)
}

print("local document text from `example`: \"\(localString)\"")
print("remote document text from `example`: \"\(remoteString)\"")
// snippet.end
// // snippet.establishDocuments
// import YSwift

// let localDocument = YDocument()
// let localText = localDocument.getOrCreateText(named: "example")
// localDocument.transactSync { txn in
// localText.append("hello, world!", in: txn)
// }

// let remoteDocument = YDocument()
// let remoteText = remoteDocument.getOrCreateText(named: "example")
// // snippet.end

// // snippet.displayTextFromDocuments
// localDocument.transactSync { txn in
// print("local document text from `example`: \"\(localText.getString(in: txn))\"")
// }

// remoteDocument.transactSync { txn in
// print("remote document text from `example`: \"\(remoteText.getString(in: txn))\"")
// }

// // snippet.end

// // snippet.syncDocuments
// print(" --> Synchronizing local to remote")
// let remoteState = remoteDocument.transactSync { txn in
// txn.transactionStateVector()
// }

// print(" . Size of the remote state is \(remoteState.count) bytes.")
// let updateRemote = localDocument.transactSync { txn in
// localDocument.diff(txn: txn, from: remoteState)
// }

// print(" . Size of the diff from remote state is \(updateRemote.count) bytes.")
// remoteDocument.transactSync { txn in
// try! txn.transactionApplyUpdate(update: updateRemote)
// }

// // snippet.end

// // Synchronization complete, read out results into local variables

// // snippet.captureAndDisplaySyncedData
// let localString = localDocument.transactSync { txn in
// localText.getString(in: txn)
// }

// let remoteString = remoteDocument.transactSync { txn in
// remoteText.getString(in: txn)
// }

// print("local document text from `example`: \"\(localString)\"")
// print("remote document text from `example`: \"\(remoteString)\"")
// // snippet.end
10 changes: 5 additions & 5 deletions lib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ lto = true
codegen-units = 1
panic = "abort"

[workspace]
members = [
"uniffi-bindgen",
]
[[bin]]
name = "uniffi-bindgen"
path = "uniffi-bindgen.rs"
required-features = ["uniffi/cli"]

[dependencies]
yrs = "0.17.4"
thiserror = "1.0.38"
uniffi = "0.26.1"
yrs = "0.17.2"

[build-dependencies]
uniffi = { version = "0.26.1", features = [ "build" ] }
Expand Down
62 changes: 0 additions & 62 deletions lib/swift/scaffold/Documentation.docc/Documentation.md

This file was deleted.

Loading

0 comments on commit a412bbe

Please sign in to comment.