UIBarButtonItem.appearance().setTitleTextAttributes()
doesn't work on iOS 13.
The way iOS handles global appearances appears to have changed. You'll need to add a condition check for iOS 13 and above and then add your attributes as shown below.
if #available(iOS 13.0, *) {
let standard = UINavigationBarAppearance()
standard.configureWithTransparentBackground()
// TITLE STYLING
standard.titleTextAttributes = [.foregroundColor: UIColor.white, .font: "FONTNAME"]
// NAV BUTTON STYLING
let button = UIBarButtonItemAppearance(style: .plain)
button.normal.titleTextAttributes = [.foregroundColor: .white, .font: "FONTNAME"]
standard.buttonAppearance = button
let done = UIBarButtonItemAppearance(style: .done)
done.normal.titleTextAttributes = [.foregroundColor: .white, .font: "FONTNAME"]
standard.doneButtonAppearance = done
UINavigationBar.appearance().standardAppearance = standard
} else {
// Your previous styling here for 12 and below
}
Check out this post for more. I found it really useful in understanding the new updates.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With