iOS15 and 16 no longer supports obscuresBackgroundDuringPresentation for UISearchController

On previous iOS versions, these lines create a UISearchController that, when clicked, dims the background underneath.

import UIKit

class ViewController: UIViewController {

    let searchController = UISearchController()

    override func viewDidLoad() {

        super.viewDidLoad()
        self.navigationItem.searchController = searchController
    }
}

On iOS 15 and 16, this is no longer the case, the background is not dimmed by default

And setting the obscuresBackgroundDuringPresentation to true dims the search bar itself.

Is there a solution to only obscure the background and no the bar?

iOS15 and 16 no longer supports obscuresBackgroundDuringPresentation for UISearchController
 
 
Q