49 lines
1.6 KiB
Swift
49 lines
1.6 KiB
Swift
//
|
|
// AttributeModel.swift
|
|
// MVMCoreUI
|
|
//
|
|
// Created by Suresh, Kamlesh on 9/10/19.
|
|
// Copyright © 2019 Verizon Wireless. All rights reserved.
|
|
//
|
|
|
|
import Foundation
|
|
|
|
public class AttributeModel: BaseModel {
|
|
var type: String?
|
|
var location: Int?
|
|
var length: Int?
|
|
var textColor: String?
|
|
var size: Int?
|
|
var name: String?
|
|
|
|
private enum CodingKeys : String, CodingKey {
|
|
case type
|
|
case location
|
|
case length
|
|
case textColor
|
|
case size
|
|
case name
|
|
}
|
|
|
|
public required init(from decoder: Decoder) throws {
|
|
try super.init(from: decoder)
|
|
let container = try decoder.container(keyedBy: CodingKeys.self)
|
|
type = try container.decode(String.self, forKey: CodingKeys.type)
|
|
location = try container.decode(Int.self, forKey: CodingKeys.location)
|
|
length = try container.decode(Int.self, forKey: CodingKeys.length)
|
|
textColor = try container.decode(String.self, forKey: CodingKeys.textColor)
|
|
size = try container.decode(Int.self, forKey: CodingKeys.size)
|
|
name = try container.decode(String.self, forKey: CodingKeys.name)
|
|
}
|
|
|
|
public override func encode(to encoder: Encoder) throws {
|
|
try super.encode(to: encoder)
|
|
var container = encoder.container(keyedBy: CodingKeys.self)
|
|
try container.encode(type, forKey: .type)
|
|
try container.encode(location, forKey: .location)
|
|
try container.encode(textColor, forKey: .textColor)
|
|
try container.encode(size, forKey: .size)
|
|
try container.encode(name, forKey: .name)
|
|
}
|
|
}
|