CMSCategoryData.swift 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. //
  2. // CMSCategoryData.swift
  3. // O2Platform
  4. //
  5. // Created by FancyLou on 2018/8/22.
  6. // Copyright © 2018 zoneland. All rights reserved.
  7. //
  8. import Foundation
  9. import ObjectMapper
  10. class CMSCategoryData : NSObject, NSCoding, Mappable{
  11. var count : Int?
  12. var data : [CMSWrapOutCategoryList]?
  13. var date : String?
  14. var message : String?
  15. var position : Int?
  16. var size : Int?
  17. var spent : Int?
  18. var type : String?
  19. var userMessage : String?
  20. class func newInstance(map: Map) -> Mappable?{
  21. return CMSCategoryData()
  22. }
  23. required init?(map: Map){}
  24. private override init(){}
  25. func mapping(map: Map)
  26. {
  27. count <- map["count"]
  28. data <- map["data"]
  29. date <- map["date"]
  30. message <- map["message"]
  31. position <- map["position"]
  32. size <- map["size"]
  33. spent <- map["spent"]
  34. type <- map["type"]
  35. userMessage <- map["userMessage"]
  36. }
  37. /**
  38. * NSCoding required initializer.
  39. * Fills the data from the passed decoder
  40. */
  41. @objc required init(coder aDecoder: NSCoder)
  42. {
  43. count = aDecoder.decodeObject(forKey: "count") as? Int
  44. data = aDecoder.decodeObject(forKey: "data") as? [CMSWrapOutCategoryList]
  45. date = aDecoder.decodeObject(forKey: "date") as? String
  46. message = aDecoder.decodeObject(forKey: "message") as? String
  47. position = aDecoder.decodeObject(forKey: "position") as? Int
  48. size = aDecoder.decodeObject(forKey: "size") as? Int
  49. spent = aDecoder.decodeObject(forKey: "spent") as? Int
  50. type = aDecoder.decodeObject(forKey: "type") as? String
  51. userMessage = aDecoder.decodeObject(forKey: "userMessage") as? String
  52. }
  53. /**
  54. * NSCoding required method.
  55. * Encodes mode properties into the decoder
  56. */
  57. @objc func encode(with aCoder: NSCoder)
  58. {
  59. if count != nil{
  60. aCoder.encode(count, forKey: "count")
  61. }
  62. if data != nil{
  63. aCoder.encode(data, forKey: "data")
  64. }
  65. if date != nil{
  66. aCoder.encode(date, forKey: "date")
  67. }
  68. if message != nil{
  69. aCoder.encode(message, forKey: "message")
  70. }
  71. if position != nil{
  72. aCoder.encode(position, forKey: "position")
  73. }
  74. if size != nil{
  75. aCoder.encode(size, forKey: "size")
  76. }
  77. if spent != nil{
  78. aCoder.encode(spent, forKey: "spent")
  79. }
  80. if type != nil{
  81. aCoder.encode(type, forKey: "type")
  82. }
  83. if userMessage != nil{
  84. aCoder.encode(userMessage, forKey: "userMessage")
  85. }
  86. }
  87. }