remove axis property wrapper
This commit is contained in:
parent
ebf089888b
commit
5a1aad63c7
@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user