mirror of
https://github.com/divkit/divkit.git
synced 2026-06-06 20:07:59 +00:00
51 lines
1.2 KiB
Swift
51 lines
1.2 KiB
Swift
// Generated code. Do not modify.
|
|
|
|
import Foundation
|
|
import Serialization
|
|
import VGSL
|
|
|
|
public final class DivAspect: Sendable {
|
|
public let ratio: Expression<Double> // constraint: number > 0
|
|
|
|
public func resolveRatio(_ resolver: ExpressionResolver) -> Double? {
|
|
resolver.resolveNumeric(ratio)
|
|
}
|
|
|
|
static let ratioValidator: AnyValueValidator<Double> =
|
|
makeValueValidator(valueValidator: { $0 > 0 })
|
|
|
|
public convenience init(dictionary: [String: Any], context: ParsingContext) throws {
|
|
self.init(
|
|
ratio: try dictionary.getExpressionField("ratio", validator: Self.ratioValidator, context: context)
|
|
)
|
|
}
|
|
|
|
init(
|
|
ratio: Expression<Double>
|
|
) {
|
|
self.ratio = ratio
|
|
}
|
|
}
|
|
|
|
#if DEBUG
|
|
extension DivAspect: Equatable {
|
|
public static func ==(lhs: DivAspect, rhs: DivAspect) -> Bool {
|
|
guard
|
|
lhs.ratio == rhs.ratio
|
|
else {
|
|
return false
|
|
}
|
|
return true
|
|
}
|
|
}
|
|
#endif
|
|
|
|
extension DivAspect: Serializable {
|
|
@_optimize(size)
|
|
public func toDictionary() -> [String: ValidSerializationValue] {
|
|
var result: [String: ValidSerializationValue] = [:]
|
|
result["ratio"] = ratio.toValidSerializationValue()
|
|
return result
|
|
}
|
|
}
|