LevelModel.swift 1004 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. //
  2. // LevelModel.swift
  3. // Learn Genie
  4. //
  5. // Created by Suraj Kumar Mandal on 13/09/21.
  6. //
  7. import Foundation
  8. import RealmSwift
  9. class LevelModel: Object {
  10. @objc dynamic var id = 0
  11. @objc dynamic var dateCreated = ""
  12. @objc dynamic var lastUpdated = ""
  13. @objc dynamic var name = ""
  14. @objc dynamic var iconBytes = ""
  15. var topics = List<Topics>()
  16. override static func primaryKey() -> String? {
  17. return "id"
  18. }
  19. convenience init(id:Int, dateCreated:String, lastUpdated:String, name:String, topics:List<Topics>, iconByte:String) {
  20. self.init()
  21. self.id = id
  22. self.dateCreated = dateCreated
  23. self.lastUpdated = lastUpdated
  24. self.name = name
  25. self.topics = topics
  26. self.iconBytes = iconByte
  27. }
  28. }
  29. class Topics: Object {
  30. @objc dynamic var id = 0
  31. override static func primaryKey() -> String? {
  32. return "id"
  33. }
  34. convenience init(id:Int) {
  35. self.init()
  36. self.id = id
  37. }
  38. }