1

I want to Programatically trigger .editingChanged for a UITextField

Defining the UITextField as:

let test = UITextField()

I've tried the following:

    test.pressesChanged(Set(_immutableCocoaSet: UIPress()), with: .some(UIPressesEvent()))
    test.didChange(.replacement, valuesAt: IndexSet(), for: \.text)
    test.didChange(NSKeyValueChange(rawValue: 0)!, valuesAt: IndexSet(), for:  \.text)
    UITextField.didChangeValue(forKey: \.text)
    test.didChangeValue(for: \.text)
    test.didChangeValue(for: \.touch)
    UIControl.Event.editingChanged

I suspect there is a solution using test.Event.editingChanged but I can't seem to find it

WishIHadThreeGuns
  • 1,225
  • 3
  • 17
  • 37

1 Answers1

2

You can call test.sendActions(for: .editingChanged). Is this what you need?

Goergisn
  • 617
  • 4
  • 15