Files
divkit/client/ios/DivKitExtensions/ExtensionHandlers/InputPropertiesExtensionHandler.swift
booster b489b36d92 Fixed file path in precommit hook
commit_hash:f7df7bc7f68f49dd4b005691712d8784e092107e
2025-07-17 17:28:31 +03:00

44 lines
1.0 KiB
Swift

import DivKit
import LayoutKit
import VGSL
public final class InputPropertiesExtensionHandler: DivExtensionHandler {
public let id = "input_properties"
public init() {}
public func applyBeforeBaseProperties(
to block: Block,
div: DivBase,
context: DivBlockModelingContext
) -> Block {
guard let textInputBlock = block as? TextInputBlock else {
return block
}
let params = getExtensionParams(div)
var newBlock = textInputBlock
if let enablesReturnKeyAutomatically = try? params.getOptionalBool(
"enables_return_key_automatically",
expressionResolver: context.expressionResolver
) {
newBlock = newBlock.modifying(
enablesReturnKeyAutomatically: enablesReturnKeyAutomatically
)
}
if let spellChecking = try? params.getOptionalBool(
"spell_checking",
expressionResolver: context.expressionResolver
) {
newBlock = newBlock.modifying(
spellChecking: spellChecking
)
}
return newBlock
}
}