AckeeCZ/ACKategories

iOS 13 revealed `textField` on `UISearchBar`

Closed this issue ยท 3 comments

So we can use it natively instead of our hack ๐ŸŽ‰

var textField: UITextField! { return value(forKey: "searchField") as? UITextField }

But only for 13+ ๐Ÿ˜ฌ Removal is breaking change which is not good so I suggest just to deprecate this and we're done.

I think that the same approach as view use for view.safeArea is optimal, at least for now.

public var safeArea: UILayoutGuide {

Finally implemented in #61 in a bit different way as @LukasHromadnik suggested. The implementation is as discussed here, it uses searchTextField on iOS 13+, on older systems it uses the old value(forKey:) method.

In addition it is marked to be deprecated on iOS 13+, so it reports a deprecation warning if deployment target is iOS 13+ (we should do this also for the UIView.safeArea), otherwise it compiles without any warning.