Skip to content

Instantly share code, notes, and snippets.

@own2pwn
Created April 15, 2018 21:35
Show Gist options
  • Save own2pwn/ebefbb83b0231d5ea79158ef0a929398 to your computer and use it in GitHub Desktop.
Save own2pwn/ebefbb83b0231d5ea79158ef0a929398 to your computer and use it in GitHub Desktop.
open class RealmModel: Object {
// MARK: - Properties
@objc dynamic var id: Int = nextID()
// MARK: - Internal
private static func nextID() -> Int {
return RealmService.shared.nextID(for: self)
}
// MARK: - Realm
open override class func primaryKey() -> String? {
return "id"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment