aaronpearce / harmony Goto Github PK
View Code? Open in Web Editor NEWHarmony provides CloudKit sync for GRDB and only GRDB.
License: Other
Harmony provides CloudKit sync for GRDB and only GRDB.
License: Other
If the user has a model that has more than one object in which has the word ID
or id
in it, the func nextRecordZoneChangeBatch
on Line 192, the return on Line 206 will return a null
record. This means that there will be no CloudKit sync possible and there is no specific error reflecting this.
Unsure if this is relevant to #3.
// Bad Model
struct Achievement: HRecord, Codable, Identifiable, Hashable {
var id: UUID = UUID()
var achievementID: String
var zoneID: CKRecordZone.ID {
return CKRecordZone.ID(
zoneName: "Achievement",
ownerName: CKCurrentUserDefaultName
)
}
var archivedRecordData: Data?
var record: CKRecord {
let encoder = CKRecordEncoder(zoneID: zoneID)
return try! encoder.encode(self)
}
}
// Acceptable Model
struct Achievement: HRecord, Codable, Identifiable, Hashable {
var id: UUID = UUID()
var achievementType: String
var zoneID: CKRecordZone.ID {
return CKRecordZone.ID(
zoneName: "Achievement",
ownerName: CKCurrentUserDefaultName
)
}
var archivedRecordData: Data?
var record: CKRecord {
let encoder = CKRecordEncoder(zoneID: zoneID)
return try! encoder.encode(self)
}
}
I started investing Harmony for my project, which has a number of tables and pivot tables. The pivot tables have primary keys that are just the 2 UUIDs for each of the tables it connects. If I understand correctly, Harmony requires HRecord
types have a UUID ID, which these pivot tables lack.
I suppose I could add a third column to this table, which would just be a UUID for the row itself, though it isn't technically necessary.
I took a brief shot at refactoring HRecord to use a generic ID that could be encoded/decoded from a String, but the type erasure I tried threw me off.
Do you think this is technically feasible? Is there a reason for the UUID requirement besides ease of implementation?
I don't mind taking a shot at implementation
Is Harmony backwards compatible with iOS 15 and 16? Thanks!
Need to add an error to the function at Line 427 to handle missing model types in the syncable list.
func modelType(for recordType: String) -> (any HRecord.Type)? {
guard let modelType = self.modelTypes.first(where: { t in
return t.recordType == recordType
}) else {
// Add error!
return nil
}
return modelType
}
As we require the CloudKit entitlement to test, we'll need to create a test host app to provide the ability for testing of the library.
This app could also be dual purpose as a demo application.
We should revisit the record ID system and see if we can provide a better way to get record type from the system alongside the actual identifier.
Currently we merge the record type and identifier into a singular identifier for pushing to CloudKit.
We could look to keep a local mapping of identifier to record type in GRDB, or continue with the current system with some improvements.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.