67 lines
2.5 KiB
Swift
67 lines
2.5 KiB
Swift
//
|
|
// LabelModel.swift
|
|
// MVMCoreUI
|
|
//
|
|
// Created by Suresh, Kamlesh on 9/10/19.
|
|
// Copyright © 2019 Verizon Wireless. All rights reserved.
|
|
//
|
|
|
|
import Foundation
|
|
|
|
class LabelModel: BaseModel {
|
|
|
|
var text: String
|
|
var accessibilityText: String
|
|
var textColor: String
|
|
var backgroundColor: String
|
|
var fontStyle: String
|
|
var fontName: String
|
|
var fontSize: Int
|
|
var textAlignment: String
|
|
//var attributes: AttributeModel
|
|
var html: String
|
|
|
|
private enum CodingKeys : String, CodingKey {
|
|
case text
|
|
case accessibilityText
|
|
case textColor
|
|
case backgroundColor
|
|
case fontStyle
|
|
case fontName
|
|
case fontSize
|
|
case textAlignment
|
|
//case attributes
|
|
case html
|
|
}
|
|
|
|
public required init(from decoder: Decoder) throws {
|
|
let container = try decoder.container(keyedBy: CodingKeys.self)
|
|
text = try container.decode(String.self, forKey: CodingKeys.text)
|
|
accessibilityText = try container.decode(String.self, forKey: CodingKeys.accessibilityText)
|
|
textColor = try container.decode(String.self, forKey: CodingKeys.textColor)
|
|
backgroundColor = try container.decode(String.self, forKey: CodingKeys.backgroundColor)
|
|
fontStyle = try container.decode(String.self, forKey: CodingKeys.backgroundColor)
|
|
fontName = try container.decode(String.self, forKey: CodingKeys.fontName)
|
|
textAlignment = try container.decode(String.self, forKey: CodingKeys.textAlignment)
|
|
//attributes = try container.decode(AttributeModel.self, forKey: CodingKeys.attributes)
|
|
html = try container.decode(String.self, forKey: CodingKeys.html)
|
|
fontSize = try container.decode(Int.self, forKey: CodingKeys.fontSize)
|
|
try super.init(from: decoder)
|
|
}
|
|
|
|
public override func encode(to encoder: Encoder) throws {
|
|
try super.encode(to: encoder)
|
|
var container = encoder.container(keyedBy: CodingKeys.self)
|
|
|
|
try container.encode(text, forKey: .text)
|
|
try container.encode(accessibilityText, forKey: .accessibilityText)
|
|
try container.encode(textColor, forKey: .textColor)
|
|
try container.encode(backgroundColor, forKey: .backgroundColor)
|
|
try container.encode(fontStyle, forKey: .fontStyle)
|
|
try container.encode(fontName, forKey: .fontName)
|
|
try container.encode(textAlignment, forKey: .textAlignment)
|
|
//try container.encode(attributes, forKey: .attributes)
|
|
try container.encode(html, forKey: .html)
|
|
}
|
|
}
|