PaginationModel.swift 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. //
  2. // PaginationModel.swift
  3. // Model file generated using JSONExport: https://github.com/Ahmed-Ali/JSONExport
  4. import Foundation
  5. import ObjectMapper
  6. class PaginationModel : NSObject, NSCoding, Mappable{
  7. var count : Int?
  8. var currentPage : Int?
  9. var links : [AnyObject]?
  10. var perPage : Int?
  11. var total : Int?
  12. var totalPages : Int?
  13. class func newInstance(map: Map) -> Mappable?{
  14. return PaginationModel()
  15. }
  16. required init?(map: Map){}
  17. private override init(){}
  18. func mapping(map: Map)
  19. {
  20. count <- map["count"]
  21. currentPage <- map["current_page"]
  22. links <- map["links"]
  23. perPage <- map["per_page"]
  24. total <- map["total"]
  25. totalPages <- map["total_pages"]
  26. }
  27. /**
  28. * NSCoding required initializer.
  29. * Fills the data from the passed decoder
  30. */
  31. @objc required init(coder aDecoder: NSCoder)
  32. {
  33. count = aDecoder.decodeObject(forKey: "count") as? Int
  34. currentPage = aDecoder.decodeObject(forKey: "current_page") as? Int
  35. links = aDecoder.decodeObject(forKey: "links") as? [AnyObject]
  36. perPage = aDecoder.decodeObject(forKey: "per_page") as? Int
  37. total = aDecoder.decodeObject(forKey: "total") as? Int
  38. totalPages = aDecoder.decodeObject(forKey: "total_pages") as? Int
  39. }
  40. /**
  41. * NSCoding required method.
  42. * Encodes mode properties into the decoder
  43. */
  44. @objc func encode(with aCoder: NSCoder)
  45. {
  46. if count != nil{
  47. aCoder.encode(count, forKey: "count")
  48. }
  49. if currentPage != nil{
  50. aCoder.encode(currentPage, forKey: "current_page")
  51. }
  52. if links != nil{
  53. aCoder.encode(links, forKey: "links")
  54. }
  55. if perPage != nil{
  56. aCoder.encode(perPage, forKey: "per_page")
  57. }
  58. if total != nil{
  59. aCoder.encode(total, forKey: "total")
  60. }
  61. if totalPages != nil{
  62. aCoder.encode(totalPages, forKey: "total_pages")
  63. }
  64. }
  65. }