mirror of
https://github.com/divkit/divkit.git
synced 2026-06-06 20:07:59 +00:00
118 lines
4.3 KiB
Swift
118 lines
4.3 KiB
Swift
// Generated code. Do not modify.
|
|
|
|
import Foundation
|
|
import Serialization
|
|
import VGSL
|
|
|
|
public final class DivActionAnimatorStart: Sendable {
|
|
public static let type: String = "animator_start"
|
|
public let animatorId: String
|
|
public let direction: Expression<DivAnimationDirection>?
|
|
public let duration: Expression<Int>? // constraint: number >= 0
|
|
public let endValue: DivTypedValue?
|
|
public let interpolator: Expression<DivAnimationInterpolator>?
|
|
public let repeatCount: DivCount?
|
|
public let startDelay: Expression<Int>? // constraint: number >= 0
|
|
public let startValue: DivTypedValue?
|
|
|
|
public func resolveDirection(_ resolver: ExpressionResolver) -> DivAnimationDirection? {
|
|
resolver.resolveEnum(direction)
|
|
}
|
|
|
|
public func resolveDuration(_ resolver: ExpressionResolver) -> Int? {
|
|
resolver.resolveNumeric(duration)
|
|
}
|
|
|
|
public func resolveInterpolator(_ resolver: ExpressionResolver) -> DivAnimationInterpolator? {
|
|
resolver.resolveEnum(interpolator)
|
|
}
|
|
|
|
public func resolveStartDelay(_ resolver: ExpressionResolver) -> Int? {
|
|
resolver.resolveNumeric(startDelay)
|
|
}
|
|
|
|
static let durationValidator: AnyValueValidator<Int> =
|
|
makeValueValidator(valueValidator: { $0 >= 0 })
|
|
|
|
static let startDelayValidator: AnyValueValidator<Int> =
|
|
makeValueValidator(valueValidator: { $0 >= 0 })
|
|
|
|
public convenience init(dictionary: [String: Any], context: ParsingContext) throws {
|
|
self.init(
|
|
animatorId: try dictionary.getField("animator_id", context: context),
|
|
direction: try dictionary.getOptionalExpressionField("direction", context: context),
|
|
duration: try dictionary.getOptionalExpressionField("duration", validator: Self.durationValidator, context: context),
|
|
endValue: try dictionary.getOptionalField("end_value", transform: { (dict: [String: Any]) in try DivTypedValue(dictionary: dict, context: context) }),
|
|
interpolator: try dictionary.getOptionalExpressionField("interpolator", context: context),
|
|
repeatCount: try dictionary.getOptionalField("repeat_count", transform: { (dict: [String: Any]) in try DivCount(dictionary: dict, context: context) }),
|
|
startDelay: try dictionary.getOptionalExpressionField("start_delay", validator: Self.startDelayValidator, context: context),
|
|
startValue: try dictionary.getOptionalField("start_value", transform: { (dict: [String: Any]) in try DivTypedValue(dictionary: dict, context: context) })
|
|
)
|
|
}
|
|
|
|
init(
|
|
animatorId: String,
|
|
direction: Expression<DivAnimationDirection>? = nil,
|
|
duration: Expression<Int>? = nil,
|
|
endValue: DivTypedValue? = nil,
|
|
interpolator: Expression<DivAnimationInterpolator>? = nil,
|
|
repeatCount: DivCount? = nil,
|
|
startDelay: Expression<Int>? = nil,
|
|
startValue: DivTypedValue? = nil
|
|
) {
|
|
self.animatorId = animatorId
|
|
self.direction = direction
|
|
self.duration = duration
|
|
self.endValue = endValue
|
|
self.interpolator = interpolator
|
|
self.repeatCount = repeatCount
|
|
self.startDelay = startDelay
|
|
self.startValue = startValue
|
|
}
|
|
}
|
|
|
|
#if DEBUG
|
|
extension DivActionAnimatorStart: Equatable {
|
|
public static func ==(lhs: DivActionAnimatorStart, rhs: DivActionAnimatorStart) -> Bool {
|
|
guard
|
|
lhs.animatorId == rhs.animatorId,
|
|
lhs.direction == rhs.direction,
|
|
lhs.duration == rhs.duration
|
|
else {
|
|
return false
|
|
}
|
|
guard
|
|
lhs.endValue == rhs.endValue,
|
|
lhs.interpolator == rhs.interpolator,
|
|
lhs.repeatCount == rhs.repeatCount
|
|
else {
|
|
return false
|
|
}
|
|
guard
|
|
lhs.startDelay == rhs.startDelay,
|
|
lhs.startValue == rhs.startValue
|
|
else {
|
|
return false
|
|
}
|
|
return true
|
|
}
|
|
}
|
|
#endif
|
|
|
|
extension DivActionAnimatorStart: Serializable {
|
|
@_optimize(size)
|
|
public func toDictionary() -> [String: ValidSerializationValue] {
|
|
var result: [String: ValidSerializationValue] = [:]
|
|
result["type"] = Self.type
|
|
result["animator_id"] = animatorId
|
|
result["direction"] = direction?.toValidSerializationValue()
|
|
result["duration"] = duration?.toValidSerializationValue()
|
|
result["end_value"] = endValue?.toDictionary()
|
|
result["interpolator"] = interpolator?.toValidSerializationValue()
|
|
result["repeat_count"] = repeatCount?.toDictionary()
|
|
result["start_delay"] = startDelay?.toValidSerializationValue()
|
|
result["start_value"] = startValue?.toDictionary()
|
|
return result
|
|
}
|
|
}
|