CMSSingleApplication.swift 2.6 KB

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