mirror of
https://github.com/divkit/divkit.git
synced 2026-06-06 20:07:59 +00:00
21 lines
566 B
Swift
21 lines
566 B
Swift
import Foundation
|
|
|
|
final class SetVariableActionHandler {
|
|
func handle(_ action: DivActionSetVariable, context: DivActionHandlingContext) {
|
|
let expressionResolver = context.expressionResolver
|
|
guard let variableName = action.resolveVariableName(expressionResolver) else {
|
|
return
|
|
}
|
|
|
|
guard let variableValue = action.value.resolveVariableValue(expressionResolver) else {
|
|
return
|
|
}
|
|
|
|
context.variablesStorage.update(
|
|
path: context.path,
|
|
name: DivVariableName(rawValue: variableName),
|
|
value: variableValue
|
|
)
|
|
}
|
|
}
|