Adds support for syncing Cheats

This commit is contained in:
Riley Testut 2018-11-14 14:10:19 -08:00
parent fb9272cd6c
commit 5b64ca7c7b
2 changed files with 17 additions and 1 deletions

View File

@ -4,7 +4,7 @@
<attribute name="code" attributeType="String" syncable="YES"/>
<attribute name="creationDate" attributeType="Date" usesScalarValueType="NO" syncable="YES"/>
<attribute name="identifier" attributeType="String" syncable="YES"/>
<attribute name="isEnabled" attributeType="Boolean" defaultValueString="YES" usesScalarValueType="NO" syncable="YES"/>
<attribute name="isEnabled" attributeType="Boolean" defaultValueString="NO" usesScalarValueType="NO" syncable="YES"/>
<attribute name="modifiedDate" attributeType="Date" usesScalarValueType="NO" syncable="YES"/>
<attribute name="name" optional="YES" attributeType="String" syncable="YES"/>
<attribute name="type" attributeType="Transformable" syncable="YES">

View File

@ -9,6 +9,7 @@
import Foundation
import DeltaCore
import Harmony
@objc(Cheat)
public class Cheat: _Cheat, CheatProtocol
@ -29,3 +30,18 @@ public class Cheat: _Cheat, CheatProtocol
self.primitiveModifiedDate = date
}
}
extension Cheat: Syncable
{
public static var syncablePrimaryKey: AnyKeyPath {
return \Cheat.identifier
}
public var syncableKeys: Set<AnyKeyPath> {
return [\Cheat.code, \Cheat.creationDate, \Cheat.modifiedDate, \Cheat.name, \Cheat.type]
}
public var syncableRelationships: Set<AnyKeyPath> {
return [\Cheat.game as AnyKeyPath]
}
}