Files
divkit/client/ios/DivKitTests/Entities/generated_sources/EntityWithComplexPropertyWithDefaultValue.swift
feldspar e234cd83fa Added untyped template resolver
commit_hash:299c999f2d6caad74d8568059e890770d7a6b1f2
2026-02-13 12:08:22 +03:00

91 lines
2.6 KiB
Swift

// Generated code. Do not modify.
@testable import DivKit
import Foundation
import Serialization
import VGSL
import enum DivKit.Expression
public final class EntityWithComplexPropertyWithDefaultValue: Sendable {
public final class Property: Sendable {
public let value: Expression<String>
public func resolveValue(_ resolver: ExpressionResolver) -> String? {
resolver.resolveString(value)
}
public convenience init(dictionary: [String: Any], context: ParsingContext) throws {
self.init(
value: try dictionary.getExpressionField("value", context: context)
)
}
init(
value: Expression<String>
) {
self.value = value
}
}
public static let type: String = "entity_with_complex_property_with_default_value"
public let property: Property // default value: EntityWithComplexPropertyWithDefaultValue.Property(value: .value("Default text"))
public convenience init(dictionary: [String: Any], context: ParsingContext) throws {
self.init(
property: try dictionary.getOptionalField("property", transform: { (dict: [String: Any]) in try EntityWithComplexPropertyWithDefaultValue.Property(dictionary: dict, context: context) })
)
}
init(
property: Property? = nil
) {
self.property = property ?? EntityWithComplexPropertyWithDefaultValue.Property(value: .value("Default text"))
}
}
#if DEBUG
extension EntityWithComplexPropertyWithDefaultValue: Equatable {
public static func ==(lhs: EntityWithComplexPropertyWithDefaultValue, rhs: EntityWithComplexPropertyWithDefaultValue) -> Bool {
guard
lhs.property == rhs.property
else {
return false
}
return true
}
}
#endif
extension EntityWithComplexPropertyWithDefaultValue: 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 EntityWithComplexPropertyWithDefaultValue.Property: Equatable {
public static func ==(lhs: EntityWithComplexPropertyWithDefaultValue.Property, rhs: EntityWithComplexPropertyWithDefaultValue.Property) -> Bool {
guard
lhs.value == rhs.value
else {
return false
}
return true
}
}
#endif
extension EntityWithComplexPropertyWithDefaultValue.Property: Serializable {
@_optimize(size)
public func toDictionary() -> [String: ValidSerializationValue] {
var result: [String: ValidSerializationValue] = [:]
result["value"] = value.toValidSerializationValue()
return result
}
}