remove axis property wrapper
This commit is contained in:
parent
ebf089888b
commit
5a1aad63c7
@ -60,28 +60,18 @@ extension NSLayoutConstraint.Axis: RawRepresentable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@propertyWrapper
|
extension NSLayoutConstraint.Axis: Codable {
|
||||||
public struct Axis {
|
|
||||||
public var wrappedValue: NSLayoutConstraint.Axis
|
|
||||||
|
|
||||||
public init(wrappedValue value: NSLayoutConstraint.Axis) {
|
|
||||||
self.wrappedValue = value
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
extension Axis: Codable {
|
|
||||||
public init(from decoder: Decoder) throws {
|
public init(from decoder: Decoder) throws {
|
||||||
let typeContainer = try decoder.singleValueContainer()
|
let typeContainer = try decoder.singleValueContainer()
|
||||||
let string = try typeContainer.decode(String.self)
|
let string = try typeContainer.decode(String.self)
|
||||||
guard let axis = NSLayoutConstraint.Axis(rawValue: string) else {
|
guard let axis = NSLayoutConstraint.Axis(rawValue: string) else {
|
||||||
throw AxisError.notAnAxis
|
throw AxisError.notAnAxis
|
||||||
}
|
}
|
||||||
wrappedValue = axis
|
self = axis
|
||||||
}
|
}
|
||||||
|
|
||||||
public func encode(to encoder: Encoder) throws {
|
public func encode(to encoder: Encoder) throws {
|
||||||
let string = wrappedValue.rawValueString
|
|
||||||
var container = encoder.singleValueContainer()
|
var container = encoder.singleValueContainer()
|
||||||
try container.encode(string)
|
try container.encode(rawValueString)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user