update to label attributes

This commit is contained in:
Pfeil, Scott Robert 2020-02-18 14:29:35 -05:00
parent 0360258c31
commit db8a27ec2f
2 changed files with 10 additions and 9 deletions

View File

@ -16,7 +16,11 @@ open class LabelAttributeActionModel: LabelAttributeModel {
public init(_ location: Int, _ length: Int, action: ActionModelProtocol) {
self.action = action
super.init(Self.identifier, location, length)
super.init(location, length)
}
private enum CodingKeys: String, CodingKey {
case action
}
required public init(from decoder: Decoder) throws {
@ -30,8 +34,4 @@ open class LabelAttributeActionModel: LabelAttributeModel {
var container = encoder.container(keyedBy: CodingKeys.self)
try container.encodeModel(action, forKey: .action)
}
private enum CodingKeys: String, CodingKey {
case action
}
}

View File

@ -25,12 +25,14 @@ import Foundation
return ""
}
var type: String
var type: String {
get { return Self.identifier }
}
var location: Int
var length: Int
init(_ type: String, _ location: Int, _ length: Int) {
self.type = type
init(_ location: Int, _ length: Int) {
self.location = location
self.length = length
}
@ -51,7 +53,6 @@ import Foundation
required public init(from decoder: Decoder) throws {
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
type = try typeContainer.decode(String.self, forKey: .type)
location = try typeContainer.decode(Int.self, forKey: .location)
length = try typeContainer.decode(Int.self, forKey: .length)
}