Filter newline characters from the "textField(_: shouldChangeCharactersIn: replacementString: )" function in the InputAlertView component for the Browse module.
This commit is contained in:
parent
b77f1b758c
commit
5aeec04e19
@ -118,10 +118,16 @@ extension InputAlertView {
|
|||||||
|
|
||||||
// MARK: UITextFieldDelegate
|
// MARK: UITextFieldDelegate
|
||||||
|
|
||||||
func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool {
|
func textField(
|
||||||
|
_ textField: UITextField,
|
||||||
|
shouldChangeCharactersIn range: NSRange,
|
||||||
|
replacementString string: String
|
||||||
|
) -> Bool {
|
||||||
component.textFieldString = {
|
component.textFieldString = {
|
||||||
if let text = textField.text as NSString? {
|
if let text = textField.text as NSString? {
|
||||||
return text.replacingCharacters(in: range, with: string)
|
return text
|
||||||
|
.replacingCharacters(in: range, with: string)
|
||||||
|
.trimmingCharacters(in: .newlines)
|
||||||
} else {
|
} else {
|
||||||
return .empty
|
return .empty
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user