update to label attributes
This commit is contained in:
parent
0360258c31
commit
db8a27ec2f
@ -16,7 +16,11 @@ open class LabelAttributeActionModel: LabelAttributeModel {
|
|||||||
|
|
||||||
public init(_ location: Int, _ length: Int, action: ActionModelProtocol) {
|
public init(_ location: Int, _ length: Int, action: ActionModelProtocol) {
|
||||||
self.action = action
|
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 {
|
required public init(from decoder: Decoder) throws {
|
||||||
@ -30,8 +34,4 @@ open class LabelAttributeActionModel: LabelAttributeModel {
|
|||||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||||
try container.encodeModel(action, forKey: .action)
|
try container.encodeModel(action, forKey: .action)
|
||||||
}
|
}
|
||||||
|
|
||||||
private enum CodingKeys: String, CodingKey {
|
|
||||||
case action
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -25,12 +25,14 @@ import Foundation
|
|||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
var type: String
|
var type: String {
|
||||||
|
get { return Self.identifier }
|
||||||
|
}
|
||||||
|
|
||||||
var location: Int
|
var location: Int
|
||||||
var length: Int
|
var length: Int
|
||||||
|
|
||||||
init(_ type: String, _ location: Int, _ length: Int) {
|
init(_ location: Int, _ length: Int) {
|
||||||
self.type = type
|
|
||||||
self.location = location
|
self.location = location
|
||||||
self.length = length
|
self.length = length
|
||||||
}
|
}
|
||||||
@ -51,7 +53,6 @@ import Foundation
|
|||||||
|
|
||||||
required public init(from decoder: Decoder) throws {
|
required public init(from decoder: Decoder) throws {
|
||||||
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
||||||
type = try typeContainer.decode(String.self, forKey: .type)
|
|
||||||
location = try typeContainer.decode(Int.self, forKey: .location)
|
location = try typeContainer.decode(Int.self, forKey: .location)
|
||||||
length = try typeContainer.decode(Int.self, forKey: .length)
|
length = try typeContainer.decode(Int.self, forKey: .length)
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user