remove axis property wrapper

This commit is contained in:
Pfeil, Scott Robert 2020-01-24 10:33:16 -05:00
parent ebf089888b
commit 5a1aad63c7

View File

@ -60,28 +60,18 @@ extension NSLayoutConstraint.Axis: RawRepresentable {
}
}
@propertyWrapper
public struct Axis {
public var wrappedValue: NSLayoutConstraint.Axis
public init(wrappedValue value: NSLayoutConstraint.Axis) {
self.wrappedValue = value
}
}
extension Axis: Codable {
extension NSLayoutConstraint.Axis: Codable {
public init(from decoder: Decoder) throws {
let typeContainer = try decoder.singleValueContainer()
let string = try typeContainer.decode(String.self)
guard let axis = NSLayoutConstraint.Axis(rawValue: string) else {
throw AxisError.notAnAxis
}
wrappedValue = axis
self = axis
}
public func encode(to encoder: Encoder) throws {
let string = wrappedValue.rawValueString
var container = encoder.singleValueContainer()
try container.encode(string)
try container.encode(rawValueString)
}
}