Multip progress

This commit is contained in:
Pfeil, Scott Robert 2020-01-08 16:45:42 -05:00
parent b3f10ec1c6
commit b97416e7d6

View File

@ -20,33 +20,31 @@ import Foundation
@objcMembers public class MultiProgressBarModel: MoleculeProtocol {
public static var identifier: String = "multiProgressBar"
public var moleculeName: String
public var backgroundColor: Color?
public var progressList: [SingleProgressBarModel]
public var backgroundColor: Color?
public var thickness: CGFloat?
public var roundedRect: Bool?
enum CodingKeys: String, CodingKey {
case moleculeName
case progressList
case thickness
case roundedRect
case backgroundColor
}
required public init(from decoder: Decoder) throws {
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
self.moleculeName = try typeContainer.decode(String.self, forKey: .moleculeName)
self.progressList = try typeContainer.decode([SingleProgressBarModel].self, forKey: .progressList)
self.thickness = try typeContainer.decodeIfPresent(CGFloat.self, forKey: .thickness)
self.roundedRect = try typeContainer.decodeIfPresent(Bool.self, forKey: .roundedRect)
progressList = try typeContainer.decode([SingleProgressBarModel].self, forKey: .progressList)
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
thickness = try typeContainer.decodeIfPresent(CGFloat.self, forKey: .thickness)
roundedRect = try typeContainer.decodeIfPresent(Bool.self, forKey: .roundedRect)
}
public func encode(to encoder: Encoder) throws {
var container = encoder.container(keyedBy: CodingKeys.self)
try container.encode(moleculeName, forKey: .moleculeName)
try container.encodeIfPresent(progressList, forKey: .progressList)
try container.encode(progressList, forKey: .progressList)
try container.encodeIfPresent(thickness, forKey: .thickness)
try container.encodeIfPresent(roundedRect, forKey: .roundedRect)
try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor)
}
}