I'm implementing UISearchController as part of the navigation item in iOS 11. This, in general, works fine. But I need to know when the searchBar is shown or hidden automatically via scrolling. None of the delegate methods in UISearchController or UISearchBar provide this information. The isActive property in UISearchController is only true when the searchBar gets focus (first responder).
The only way I've found is to use KVO on the height searchBar frame but that seams rather extreme for something like this.
Related to my requirement is also the ability to programmatically hide the searchBar (as if the user had scrolled up). The only way I've found to do this is by setting the navigation item's UISearchController property to nil but that also seems rather extreme.
Thanks.