largeTitleTextAttributes disappear after programmatic push - Swift

85 Views Asked by At

I'm pushing to a navigation controller and the large title I have set within the shootSummary VC text attributes change without warning -- they lose their original formatting. So I've tried putting them as I've done here after the push, but that hasn't worked either. Here's my code:

guard let shootSummaryVC = storyboard?.instantiateViewController(withIdentifier: "ShootPVC") as? ShootPVC else { return }
guard let indexPath = tableView.indexPathForSelectedRow else { return }
guard let shootID = shoots?[indexPath.row].id else { return }
shootSummaryVC.id = shootID
shootSummaryVC.initialPage = 3
        
DispatchQueue.main.async { [self] in

    navigationController?.pushViewController(shootSummaryVC, animated: true)
    navigationController?.hidesNavigationBarHairline = true
    navigationController?.navigationBar.topItem?.backBarButtonItem =
    UIBarButtonItem(title: "Track Payments", style: .plain, target: nil, action: nil)
    let p = NSMutableParagraphStyle()
    p.firstLineHeadIndent = 10
    navigationController?.navigationBar.largeTitleTextAttributes = [NSAttributedString.Key.font: currentTheme.titleFontLarge, NSAttributedString.Key.foregroundColor: currentTheme.navigationBarTextColor, NSAttributedString.Key.paragraphStyle: p]

}

The largeTitleTextAttributes in my attempted solution above don't affect the title. I tried setting them within the VC being pushed to (shootSummaryVC) but that hasn't worked either. Any ideas?

0

There are 0 best solutions below