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

60 lines
1.5 KiB
Swift

// Generated code. Do not modify.
@testable import DivKit
import Foundation
import Serialization
import VGSL
import enum DivKit.Expression
public final class EntityWithStringEnumPropertyWithDefaultValue: Sendable {
@frozen
public enum Value: String, CaseIterable, Sendable {
case first = "first"
case second = "second"
case third = "third"
}
public static let type: String = "entity_with_string_enum_property_with_default_value"
public let value: Expression<Value> // default value: second
public func resolveValue(_ resolver: ExpressionResolver) -> Value {
resolver.resolveEnum(value) ?? Value.second
}
public convenience init(dictionary: [String: Any], context: ParsingContext) throws {
self.init(
value: try dictionary.getOptionalExpressionField("value", context: context)
)
}
init(
value: Expression<Value>? = nil
) {
self.value = value ?? .value(.second)
}
}
#if DEBUG
extension EntityWithStringEnumPropertyWithDefaultValue: Equatable {
public static func ==(lhs: EntityWithStringEnumPropertyWithDefaultValue, rhs: EntityWithStringEnumPropertyWithDefaultValue) -> Bool {
guard
lhs.value == rhs.value
else {
return false
}
return true
}
}
#endif
extension EntityWithStringEnumPropertyWithDefaultValue: Serializable {
@_optimize(size)
public func toDictionary() -> [String: ValidSerializationValue] {
var result: [String: ValidSerializationValue] = [:]
result["type"] = Self.type
result["value"] = value.toValidSerializationValue()
return result
}
}