Realm-JSONAPI
Realm-JSONAPI copied to clipboard
RealmSwift support
It would be great if there were support for Realm's swift objects. https://realm.io/docs/swift/latest/
It seems that not a huge amount of work is required to support RealmSwift.
Since realm swift Object subclasses from RLMObjectBase rather than RLMObject.
The two categoriesRLMObject+JSONAPIParser & RLMObject+JSONAPIResource can both be categories on RLMObjectBase rather.
Since RealmSwift Objects have no createOrUpdateInRealm... I've been able to create a swift function on my model such as:
open class func createOrUpdate(inRealm: RLMRealm!, withValue: [AnyHashable : Any]!) -> User! {
let realm = try! Realm()
let user: User = realm.create(User.self, value: withValue, update: true)
return user
}
Which will succeed in creating a valid Realm object upon JSONAPIParserUtilities constructObjectWithJSON:inRealm