Post

Replies

Boosts

Views

Activity

UITextField Input Issue While Using Bilingual Keyboard in iOS 18
Input issues occur in the textField while using a bilingual keyboard (Korean and English). System settings: Keyboard: Bilingual (Korean & English) Project environment: Xcode >= 15.4 & iOS >= 18.0 Base localization: Korean // UITextField settings: textField.keyboardType = .decimalPad // or .phonePad self.textField.addTarget(self, action: #selector(self.textFieldEditingChanged), for: .editingChanged) @objc func textFieldEditingChanged() { self.textField.text = "\(self.textField.text!)-" } /* Input: 123456 Expected: 1-2-3-4-5-6- Result: 11111123456- */ The issue occurs when modifying the text of the textField in the editingChanged event. In the above code, a hyphen is appended to the input with each character. When typing 123456, the expected result is: Input: 1 → Result: 1- Input: 2 → Result: 1-2- … Input: 6 → Result: 1-2-3-4-5-6- However, the actual result is 11111123456-. Another example: @objc func textFieldEditingChanged() { print("before", self.textField.text!) self.textField.text = self.textField.text?.replacingOccurrences(of: "0", with: "1") print("after", self.textField.text!) } When inputting 0 1 0 sequentially, the output is: before 0 after 1 before 01 after 11 before 010 after 111 The value of "after" matches expectations, but the "before" value reverts to 0 on the next input, even though it appears as 1 on the UI. When the bilingual keyboard option is turned off or the base localization is set to something other than Korea, the issue does not occur. Could you provide information on whether this issue will be resolved in the next iOS version, or if there is a workaround?
7
0
580
Oct ’24