TextFieldDelegate

@MainActor
open class TextFieldDelegate : DelegateProxy<UITextFieldDelegate>, UITextFieldDelegate

常用TextField事件代理,可继承

  • 是否应该开始编辑,默认nil

    Declaration

    Swift

    @MainActor
    open var shouldBeginEditing: ((UITextField) -> Bool)?
  • 已开始编辑,默认nil

    Declaration

    Swift

    @MainActor
    open var didBeginEditing: ((UITextField) -> Void)?
  • 是否应该结束编辑,默认nil

    Declaration

    Swift

    @MainActor
    open var shouldEndEditing: ((UITextField) -> Bool)?
  • 已结束编辑,默认nil

    Declaration

    Swift

    @MainActor
    open var didEndEditing: ((UITextField) -> Void)?
  • 是否应该改变字符,默认nil

    Declaration

    Swift

    @MainActor
    open var shouldChangeCharacters: ((UITextField, NSRange, String) -> Bool)?
  • 选中已改变,仅iOS13+支持,默认nil

    Declaration

    Swift

    @MainActor
    open var didChangeSelection: ((UITextField) -> Void)?
  • 是否应该清除,默认nil

    Declaration

    Swift

    @MainActor
    open var shouldClear: ((UITextField) -> Bool)?
  • 是否应该回车,默认nil

    Declaration

    Swift

    @MainActor
    open var shouldReturn: ((UITextField) -> Bool)?

Lifecycle

  • 初始化并绑定textField

    Declaration

    Swift

    @MainActor
    public convenience init(textField: UITextField)

UITextFieldDelegate