I have code that creates a UISearchController\' in my UIVIew\'s
viewDidLoad`.
self.resultSearchController = ({
let controller = UISearch
I used Derek's answer, but had to change it slightly. The answer that was provided crashed for me because the call to loadViewIfNeeded() happened before the resultSearchController was defined. (My declaration was
var resultSearchController: UISearchController!
). So I just moved it afterwards and it worked.
If I left out the call entirely, the bug remained, so I'm sure it is an essential part of the answer. I was unable to test it on iOS 8.