Ambiguous use of the name - Xcode 9 beta
Xcode 9 beta compiler shows the following error for navigationItem.title
as well as self.navigationController?.navigationBar.topItem?.title
:
Ambiguous use of 'title'
This is my code:
self.title = BMLocalized("Select Number of Passengers")
navigationItem.title = navigationTitleString // here showing error
submitButton.setTitle(submitButtonTitle, for: .normal)
Can anyone help with this issue?
source to share
UPDATE:
Just use this code:
navigationItem.titleLabel.text = "text"
OLD ANSWER:
This is because you are using a third party library that extends the UINavigationItem class and reuses the property title. So this library conflicts with UIKit.
Decision:
Just use
title
instead
navigationItem.title
Or remove the UINavigationItem class extension in the third party library. You can see the name of this library in the problem navigator:
For MATERIAL solution:
remove these lines from Material -> Core -> NavigationItem.swift:
public var title: String? {
get {
return titleLabel.text
}
set(value) {
titleLabel.text = value
navigationItem.reload()
}
}
source to share