DensityRow.swift 1.82 KB
Newer Older
Javen's avatar
Javen committed
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 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
//
//	DensityRow.swift
//
//	Create by Javen Zhang on 29/3/2018
//	Copyright © 2018. All rights reserved.
//	Model file generated using JSONExport: https://github.com/Ahmed-Ali/JSONExport

import Foundation 
import SwiftyJSON


class DensityRow : NSObject, NSCoding{

	var devicegroup : String!
	var displaydensity : String!
	var n : String!


	/**
	 * Instantiate the instance using the passed json values to set the properties values
	 */
	init(fromJson json: JSON!){
		if json.isEmpty{
			return
		}
		devicegroup = json["devicegroup"].stringValue
		displaydensity = json["displaydensity"].stringValue
		n = json["n"].stringValue
	}

	/**
	 * Returns all the available property values in the form of [String:Any] object where the key is the approperiate json key and the value is the value of the corresponding property
	 */
	func toDictionary() -> [String:Any]
	{
		var dictionary = [String:Any]()
		if devicegroup != nil{
			dictionary["devicegroup"] = devicegroup
		}
		if displaydensity != nil{
			dictionary["displaydensity"] = displaydensity
		}
		if n != nil{
			dictionary["n"] = n
		}
		return dictionary
	}

    /**
    * NSCoding required initializer.
    * Fills the data from the passed decoder
    */
    @objc required init(coder aDecoder: NSCoder)
	{
         devicegroup = aDecoder.decodeObject(forKey: "devicegroup") as? String
         displaydensity = aDecoder.decodeObject(forKey: "displaydensity") as? String
         n = aDecoder.decodeObject(forKey: "n") as? String

	}

    /**
    * NSCoding required method.
    * Encodes mode properties into the decoder
    */
    func encode(with aCoder: NSCoder)
	{
		if devicegroup != nil{
			aCoder.encode(devicegroup, forKey: "devicegroup")
		}
		if displaydensity != nil{
			aCoder.encode(displaydensity, forKey: "displaydensity")
		}
		if n != nil{
			aCoder.encode(n, forKey: "n")
		}

	}

}