Post

Replies

Boosts

Views

Activity

Search Bar does not work on iOS 18
I belong to an EC shop application developers' team, and we got a crame from a small part of our customers about our application. "Search Bar does not work on iOS 18." This bug doesn't appear on most of our devices updated to iOS 18.0. In some cases, it disappeared by turning [Settings > Accessibility > Touch > Reachability] off. But it is not the same for all customers found the bug. I'm looking for how to fix this bug, and why it happens. I'm not sure but I doubt that this may be a bug of iOS18, UIKit, RxCocoa, RxSwift, or something else. Any information would be welcome. import UIKit import RxSwift import RxCocoa @IBDesignable public final class SearchBar: UISearchBar { var textField: UITextField { if #available(iOS 13.0, *) { return searchTextField } else { return value(forKey: "_searchField") as! UITextField } } private let disposeBag = DisposeBag() private func bind() { textField.rx.isFirstResponder .bind(to: Binder(self) { me, isFirstResponder in // This doesn't work in some iOS 18 devices. me.textField.attributedPlaceholder = placeholderAttributedString(isFirstResponder: isFirstResponder) me.textField.backgroundColor = isFirstResponder ? Asset.Colors.whiteTwo.color : .white if me.useCancelButton { me.showsCancelButton = isFirstResponder } if me.useBookmarkButton { me.showsBookmarkButton = !isFirstResponder } }) .disposed(by: disposeBag) } public override init(frame: CGRect) { super.init(frame: frame) commonInit() } public required init?(coder aDecoder: NSCoder) { super.init(coder: aDecoder) } public override func awakeFromNib() { super.awakeFromNib() commonInit() } public override func prepareForInterfaceBuilder() { super.prepareForInterfaceBuilder() commonInit() } private func commonInit() { bind() } } extension Reactive where Base: SearchBar {} import UIKit import RxSwift import RxCocoa @IBDesignable public final class SearchHeaderView: UIView { @IBOutlet private weak var searchBar: SearchBar! @IBOutlet private weak var cartContainerView: UIView! private let disposeBag = DisposeBag() public override init(frame: CGRect) { super.init(frame: frame) loadFromNib() commonInit() } public required init?(coder aDecoder: NSCoder) { super.init(coder: aDecoder) } public override func awakeFromNib() { super.awakeFromNib() loadFromNib() commonInit() } public override func prepareForInterfaceBuilder() { super.prepareForInterfaceBuilder() loadFromNib() commonInit() } private func commonInit() { bind() } private func bind() { // ↓ This doesn't work in some iOS 18 devices. searchBar.textField.rx.isFirstResponder .bind(to: cartContainerView.rx.isHidden) .disposed(by: disposeBag) } } extension SearchAndCartHeaderView: NibOwnerLoadable {}
0
0
200
3w