-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRootClass.swift
More file actions
63 lines (50 loc) · 1.35 KB
/
Copy pathRootClass.swift
File metadata and controls
63 lines (50 loc) · 1.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
//
// RootClass.swift
//
// Create by Prateek on 28/4/2018
// Copyright © 2018. All rights reserved.
// Model file generated using JSONExport: https://github.com/Ahmed-Ali/JSONExport
import Foundation
import ObjectMapper
class RootClass : NSObject, NSCoding, Mappable{
var apiInfo : ApiInfo?
var items : [Item]?
var regionMetadata : [RegionMetadata]?
class func newInstance(map: Map) -> Mappable?{
return RootClass()
}
required init?(map: Map){}
private override init(){}
func mapping(map: Map)
{
apiInfo <- map["api_info"]
items <- map["items"]
regionMetadata <- map["region_metadata"]
}
/**
* NSCoding required initializer.
* Fills the data from the passed decoder
*/
@objc required init(coder aDecoder: NSCoder)
{
apiInfo = aDecoder.decodeObject(forKey: "api_info") as? ApiInfo
items = aDecoder.decodeObject(forKey: "items") as? [Item]
regionMetadata = aDecoder.decodeObject(forKey: "region_metadata") as? [RegionMetadata]
}
/**
* NSCoding required method.
* Encodes mode properties into the decoder
*/
@objc func encode(with aCoder: NSCoder)
{
if apiInfo != nil{
aCoder.encode(apiInfo, forKey: "api_info")
}
if items != nil{
aCoder.encode(items, forKey: "items")
}
if regionMetadata != nil{
aCoder.encode(regionMetadata, forKey: "region_metadata")
}
}
}