I can't get the status bar to display the clock battery etc in white.
I read a lot of similar questions on stack overflow but most are old and not written in swift. The most recent answers I could find suggested to override func preferredStatusBarStyle which is no longer a function. I tried the following, but it doesn't work.
import Foundation
import UIKit
import MessageUI
class ContactUsViewController: MFMailComposeViewController {
    
    override var preferredStatusBarStyle: UIStatusBarStyle {
        return .lightContent
    }
    
    override func loadView() {
        super.loadView()
    }
    
    override func viewDidLoad() {
        print("mail viewDidLoad()")
        self.setNeedsStatusBarAppearanceUpdate()
    }
    
}
I call the view controller using.
if !MFMailComposeViewController.canSendMail() {
    print("Mail services are not available")
    return
}
self.timeSlider.removeFromSuperview()
let contactVC = ContactUsViewController()// MFMailComposeViewController()
contactVC.navigationBar.tintColor = UIColor.white
contactVC.mailComposeDelegate = self
            
// Configure the fields of the interface.
contactVC.setToRecipients(["support@example.com"])
contactVC.setSubject("Your subject here")
contactVC.setMessageBody("Enter message about bugs, problems, ideas how to make the app better etc.", isHTML: false)
contactVC.modalPresentationCapturesStatusBarAppearance = true
// Present the view controller
self.navigationController?.present(contactVC, animated: true, completion: nil)
What is missing from the view controller to change its StatusBarStyle?
 
     
    