1 GitHub stars and counting — robbiehanson/ZDCSyncable is a multi-language project TopGit is tracking across repositories on the platform.
Snapshot summary built from the project's own GitHub metadata — there's no written TopGit review yet. The page will update automatically when a full review is published.
WHY NO REVIEW YET
TopGit writes full reviews for the most-starred, most-requested repositories. This page is a snapshot until then — see the READ ME tab for the original README in full.
Undo, redo & merge capabilities for structs & classes in pure Swift.
By: ZeroDark.cloud: A secure sync & messaging framework for your app, built on blockchain & AWS.
Undo & Redo
Example #1
import ZDCSyncable
struct Person: ZDCSyncable { // Just add ZDCSyncable protocol
@Syncable var name: String // Then add @Syncable property wrapper.
@Syncable var age: Int = 1 // And that's it!
}
// And now you get undo & redo support
let person = Person(name = "alice")
// ^ starting point
person.name = "bob"
person.age = 2
let changeset = person.changeset() // changes since starting point
do {
let redo = try person.undo(changeset!) // revert to starting point
// Current state:
// person.name == "alice"
// person.age == 1
let _ = try person.undo(redo) // redo == (undo an undo)
// Current state:
// person.name == "bob"
// person.age == 2
} catch _ {}
If you want to use a class instead of a struct, that's supported too:
Example #2
import ZDCSyncable
class Animal: ZDCRecord { // <- Just extend ZDCRecord
@Syncable var species: String // And add @Syncable property wrapper.
@Syncable var age: Int
}
The @Syncable property wrappers work for primitive types.
And the framework comes with additional solutions for replacing collection types:
ZDCArray
ZDCDictionary
ZDCOrderedDictionary
ZDCSet
ZDCOrderedSet
These collections types mirror the API of their native Swift counterparts. And they're all implemented as structs, so you get the same value semantics you're used to.
Example #3
import ZDCSyncable
struct Television: ZDCSyncable { // Add ZDCSyncable protocol
@Syncable var brand: String // Add @Syncable property wrapper.
// Or use syncable collection class:
var specs = ZDCDictionary<String, String>()
// ZDCDictionary has almost the exact same API as Swift's Dictionary.
// And ZDCDictionary is a struct, so you get the same value semantics.
}
var tv = Television(brand: "Samsung")
tv.specs["size"] = "30"
tv.clearChangeTracking() // set starting point
tv.brand = "Sony"
tv.specs["size"] = "40"
tv.specs["widescreen"] = "true"
let changeset = tv.changeset() // changes since starting point
do {
let redo = try tv.undo(changeset!) // revert to starting point
// Current state:
// tv.brand == "Samsung"
// tv.specs["size"] == "30"
// tv.specs["widescreen"] = nil
let _ = try tv.undo(redo) // redo == (undo an undo)
// Current state:
// tv.brand == "Sony"
// tv.specs["size"] == "40"
// tv.specs["widescreen"] = "true"
} catch _ {}
Merge
You can also merge changes ! (i.e. from the cloud)
var localTV = Television(brand: "Samsung")
localTV.specs["size"] = "30"
localTV.clearChangeTracking() // set starting point
var cloudTV = localTV // Television is a struct
var changesets: [ZDCChangeset] = []
// local modifications
localTV.specs["size"] = "30.5"
localTV.specs["widescreen"] = "yes"
changesets.append(localTV.changeset() ?? ZDCChangeset())
// ^ pending local changes (not yet pushed to cloud)
// cloud modifications
cloudTV.specs["hdmi inputs"] = "2"
// Now merge cloud version into local.
// Automatically take into account our pending local changes.
do {
try localTV.merge(cloudVersion: cloudTV, pendingChangesets: changesets)
// Merged state:
// localTV.brand == "Samsung"
// localTV.specs["size"] == "30.5"
// localTV.specs["widescreen"] == "true"
// localTV.specs["hdmi inputs"] = "2"
} catch _ {}
Getting Started
ZDCSyncable is available via CocoaPods.
CocoaPods
Add the following to your Podfile:
pod 'ZDCSyncable'
Then just run pod install as usual. And then you can import it via:
// Swift
import ZDCSyncable
Motivation
Merge conflicts happen. If you've ever used git before, you know it well. And solving a merge conflict requires knowing what was changed. The same is true with your data model.
Consider the simple case of syncing a humble dictionary. Say we're notified of a conflict, and this is all we know:
With this information in hand, the merge becomes obvious:
the size property was changed locally, and was not changed by remote. Local wins
the widescreen property was added locally
the hdmi inputs property was added by remote
The ZDCSyncable project gives you the tools you need to:
track changes to you data models
store those change-set(s) while the changes are being uploaded
properly merge changes from the cloud by taking into account the set of local changes
Truth be told, it's not THAT hard to code this stuff. It's not rocket science. But it does require a TON of unit testing to get all the little edge-cases correct. Which means you could spend all that time writing those unit tests yourself, or you could use an open-source version that's already been battle-tested by the community. (And then spend your extra time making your app awesome.)
Does robbiehanson/ZDCSyncable have a project website?
No homepage URL was recorded for robbiehanson/ZDCSyncable in TopGit's last sync. The README tab above frequently contains screenshots and demo links, or check the repository description on GitHub.
Does robbiehanson/ZDCSyncable have any tags?
TopGit's last sync did not record any GitHub topics for robbiehanson/ZDCSyncable. GitHub topics appear in the right sidebar of a repository page; that's the authoritative place to check.
How many stars does robbiehanson/ZDCSyncable have?
robbiehanson/ZDCSyncable has 1 GitHub stars — refresh the page for the live number, or check github.com/robbiehanson/ZDCSyncable. TopGit mirrors GitHub's count but does not claim minute-by-minute accuracy.
Is robbiehanson/ZDCSyncable open source?
TopGit's metadata for robbiehanson/ZDCSyncable does not record a license. Most public repositories on GitHub ARE open source, but the exact terms vary — verify by opening the LICENSE file directly.
Is robbiehanson/ZDCSyncable still maintained?
TopGit's metadata for robbiehanson/ZDCSyncable does not include a recent push date. Check the commit history on the GitHub repository page for the most authoritative activity timeline.
Where do I read more about robbiehanson/ZDCSyncable?
This TopGit page is a snapshot — the READ ME tab shows the project's own README content (links stripped, images preserved). The GitHub repository at github.com/robbiehanson/ZDCSyncable is the definitive source.
Read full README in the tab above.
Curious whether ZDCSyncable is right for you?
Let ChatGPT, Claude, or Perplexity look into it — click below and see what AI actually says about ZDCSyncable.