Swift's New Forked Framework Simplifies Shared Data Management
2024-12-17
Developer Drew McCormack launched Forked, a new Swift framework for simplifying shared data management across single and multiple devices. Inspired by Git's merge mechanism, Forked supports branching and merging within a single file, achieving eventual consistency. It doesn't require a complete change history, only enough versions for three-way merging. Forked uses structs instead of classes, supports Codable, and seamlessly integrates with cloud services like iCloud. It even tackles race conditions from concurrent access and supports custom merge logic or built-in CRDT algorithms. CloudKit sync is achieved with just a few lines of code.