Updated 8 January 2018
1 2 3 4 5 6 7 8 9 |
extension UISearchBar{ public var textField: UITextField? { let subViews = subviews.flatMap { $0.subviews } guard let textField = (subViews.filter { $0 is UITextField }).first as? UITextField else { return nil } return textField } } |
12345 extension UISearchBar{public var trimmedText: String? {return text?.trimmingCharacters(in: .whitespacesAndNewlines)}}
12345 extension UISearchBar{public func clear() {text = ""}}
If you have more details or questions, you can reply to the received confirmation email.
Back to Home
Be the first to comment.