mirror of
https://github.com/divkit/divkit.git
synced 2026-06-06 20:07:59 +00:00
48 lines
1.2 KiB
Swift
48 lines
1.2 KiB
Swift
// Generated code. Do not modify.
|
|
|
|
@testable import DivKit
|
|
|
|
import CommonCorePublic
|
|
import Foundation
|
|
import Serialization
|
|
|
|
public final class EntityWithArrayWithTransform {
|
|
public static let type: String = "entity_with_array_with_transform"
|
|
public let array: [Expression<Color>] // at least 1 elements
|
|
|
|
public func resolveArray(_ resolver: ExpressionResolver) -> [Color]? {
|
|
array.map { resolver.resolveStringBasedValue(expression: $0, initializer: Color.color(withHexString:)) }.compactMap { $0 }
|
|
}
|
|
|
|
static let arrayValidator: AnyArrayValueValidator<Expression<Color>> =
|
|
makeArrayValidator(minItems: 1)
|
|
|
|
init(
|
|
array: [Expression<Color>]
|
|
) {
|
|
self.array = array
|
|
}
|
|
}
|
|
|
|
#if DEBUG
|
|
extension EntityWithArrayWithTransform: Equatable {
|
|
public static func ==(lhs: EntityWithArrayWithTransform, rhs: EntityWithArrayWithTransform) -> Bool {
|
|
guard
|
|
lhs.array == rhs.array
|
|
else {
|
|
return false
|
|
}
|
|
return true
|
|
}
|
|
}
|
|
#endif
|
|
|
|
extension EntityWithArrayWithTransform: Serializable {
|
|
public func toDictionary() -> [String: ValidSerializationValue] {
|
|
var result: [String: ValidSerializationValue] = [:]
|
|
result["type"] = Self.type
|
|
result["array"] = array.map { $0.toValidSerializationValue() }
|
|
return result
|
|
}
|
|
}
|