QuestionBankModel.swift 951 B

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