iOS 18 Navigation Title Bug

Hello. I'm encountering a strange behavior in iOS 18 and wanted to ask about it. When I run the following code on iOS 18, quotation marks appear in the navigation title.

class ViewController: UIViewController {
    override func viewDidLoad() {
        super.viewDidLoad()
        self.title = " "
        self.view.backgroundColor = .systemBlue
    }
}

In versions prior to iOS 18, the title is displayed as intended, with nothing showing up. Could this be an intentional change in iOS 18, or is it a bug?

Answered by DTS Engineer in 801362022

@Milkie I wasn’t able to reproduce the issue with the latest beta version. Could you please try reproducing the issue on iOS 18 beta 7? Thanks!

iOS 18

iOS16

@Milkie I wasn’t able to reproduce the issue with the latest beta version. Could you please try reproducing the issue on iOS 18 beta 7? Thanks!

Accepted Answer

This is expected behavior for iOS 18. Previously we would trim titles that contained only white space down to an empty string, but as of iOS 18 if we detect this, we place the title in quotes instead.

You can get the same behavior as prior to iOS 18 by just setting an empty or nil string instead of a string with a single space.

iOS 18 Navigation Title Bug
 
 
Q