UITableViewController viewWillAppear changed in iOS 15.5

My viewWillAppear (below) worked before iOS 15.5. Now, as part of super.viewWillAppear the OS calls titleForHeaderInSection, which crashes. It crashes because it calls getHeaderText, which depends on my variable monitor being bound. monitor doesn't get bound until my function setupUserGuideMonitor() is called.

class myClass: UITableViewController {

    var monitor: UserGuideMonitor!

    override func viewWillAppear(_ animated: Bool) {
        super.viewWillAppear(animated)
        self.setupUserGuideMonitor()
        self.listenForNotifications()
    }
}

There are various ways to fix this, including calling setupUserGuidMonitor before super.viewWillAppear, but my understanding of best practices is that only minimum setup should occur before super gets called.

I have a very large code base with lots of other complex viewWillAppear calls and I am worried about other fallout from this change and other similar changes that may have occurred. I found nothing about this in the release notes for 15.5.

In general I'd like to know what protocol methods are going to be invoked during a viewWillAppear. It's not like I can look at the source code for UITableViewController.

Why do you wait for viewWillAppear to call the various setup ? You should do it in viewDidLoad

class myClass: UITableViewController {

    var monitor: UserGuideMonitor!

    override func viewDidLoad() {
        super.viewDidLoad()
        self.setupUserGuideMonitor()
        self.listenForNotifications()
    }

    override func viewWillAppear(_ animated: Bool) {
        super.viewWillAppear(animated)
    }
}
UITableViewController viewWillAppear changed in iOS 15.5
 
 
Q