mirror of
https://github.com/divkit/divkit.git
synced 2026-06-06 20:07:59 +00:00
91 lines
2.3 KiB
Swift
91 lines
2.3 KiB
Swift
// Generated code. Do not modify.
|
|
|
|
@testable import DivKit
|
|
import Foundation
|
|
import Serialization
|
|
import VGSL
|
|
|
|
import enum DivKit.Expression
|
|
|
|
public final class EntityWithComplexProperty: Sendable {
|
|
public final class Property: Sendable {
|
|
public let value: Expression<URL>
|
|
|
|
public func resolveValue(_ resolver: ExpressionResolver) -> URL? {
|
|
resolver.resolveUrl(value)
|
|
}
|
|
|
|
public convenience init(dictionary: [String: Any], context: ParsingContext) throws {
|
|
self.init(
|
|
value: try dictionary.getExpressionField("value", transform: URL.makeFromNonEncodedString, context: context)
|
|
)
|
|
}
|
|
|
|
init(
|
|
value: Expression<URL>
|
|
) {
|
|
self.value = value
|
|
}
|
|
}
|
|
|
|
public static let type: String = "entity_with_complex_property"
|
|
public let property: Property
|
|
|
|
public convenience init(dictionary: [String: Any], context: ParsingContext) throws {
|
|
self.init(
|
|
property: try dictionary.getField("property", transform: { (dict: [String: Any]) in try EntityWithComplexProperty.Property(dictionary: dict, context: context) }, context: context)
|
|
)
|
|
}
|
|
|
|
init(
|
|
property: Property
|
|
) {
|
|
self.property = property
|
|
}
|
|
}
|
|
|
|
#if DEBUG
|
|
extension EntityWithComplexProperty: Equatable {
|
|
public static func ==(lhs: EntityWithComplexProperty, rhs: EntityWithComplexProperty) -> Bool {
|
|
guard
|
|
lhs.property == rhs.property
|
|
else {
|
|
return false
|
|
}
|
|
return true
|
|
}
|
|
}
|
|
#endif
|
|
|
|
extension EntityWithComplexProperty: Serializable {
|
|
@_optimize(size)
|
|
public func toDictionary() -> [String: ValidSerializationValue] {
|
|
var result: [String: ValidSerializationValue] = [:]
|
|
result["type"] = Self.type
|
|
result["property"] = property.toDictionary()
|
|
return result
|
|
}
|
|
}
|
|
|
|
#if DEBUG
|
|
extension EntityWithComplexProperty.Property: Equatable {
|
|
public static func ==(lhs: EntityWithComplexProperty.Property, rhs: EntityWithComplexProperty.Property) -> Bool {
|
|
guard
|
|
lhs.value == rhs.value
|
|
else {
|
|
return false
|
|
}
|
|
return true
|
|
}
|
|
}
|
|
#endif
|
|
|
|
extension EntityWithComplexProperty.Property: Serializable {
|
|
@_optimize(size)
|
|
public func toDictionary() -> [String: ValidSerializationValue] {
|
|
var result: [String: ValidSerializationValue] = [:]
|
|
result["value"] = value.toValidSerializationValue()
|
|
return result
|
|
}
|
|
}
|