mirror of
https://github.com/divkit/divkit.git
synced 2026-06-06 20:07:59 +00:00
58 lines
1.5 KiB
Swift
58 lines
1.5 KiB
Swift
// Generated code. Do not modify.
|
|
|
|
import Foundation
|
|
import Serialization
|
|
import VGSL
|
|
|
|
@frozen
|
|
public enum DivPivot: Sendable {
|
|
case divPivotFixed(DivPivotFixed)
|
|
case divPivotPercentage(DivPivotPercentage)
|
|
|
|
public var value: Serializable {
|
|
switch self {
|
|
case let .divPivotFixed(value):
|
|
return value
|
|
case let .divPivotPercentage(value):
|
|
return value
|
|
}
|
|
}
|
|
}
|
|
|
|
extension DivPivot {
|
|
public init(dictionary: [String: Any], context: ParsingContext) throws {
|
|
let dictionary = context.templateResolver?(dictionary) ?? dictionary
|
|
let blockType = try dictionary.getField("type") as String
|
|
switch blockType {
|
|
case DivPivotFixed.type:
|
|
self = .divPivotFixed(try DivPivotFixed(dictionary: dictionary, context: context))
|
|
case DivPivotPercentage.type:
|
|
self = .divPivotPercentage(try DivPivotPercentage(dictionary: dictionary, context: context))
|
|
default:
|
|
throw DeserializationError.requiredFieldIsMissing(field: "type")
|
|
}
|
|
}
|
|
}
|
|
|
|
#if DEBUG
|
|
extension DivPivot: Equatable {
|
|
public static func ==(lhs: DivPivot, rhs: DivPivot) -> Bool {
|
|
switch (lhs, rhs) {
|
|
case let (.divPivotFixed(l), .divPivotFixed(r)):
|
|
return l == r
|
|
case let (.divPivotPercentage(l), .divPivotPercentage(r)):
|
|
return l == r
|
|
default:
|
|
return false
|
|
}
|
|
}
|
|
}
|
|
#endif
|
|
|
|
extension DivPivot: Serializable {
|
|
@_optimize(size)
|
|
public func toDictionary() -> [String: ValidSerializationValue] {
|
|
return value.toDictionary()
|
|
}
|
|
}
|