I have set accessibilityIdentifier for both leftBarButtonItem and titleView on view did load:
override func viewDidLoad() {
super.viewDidLoad()
title = "input_nickname_title".localized()
navigationItem.leftBarButtonItem?.customView?.accessibilityIdentifier = "btn-nav-left"
navigationItem.titleView?.accessibilityIdentifier = "lbl-header"
}
but when testing using accessibility inspector, only the leftBarButtonItem is set
I also tried doing the following but it also shows identifier as none
navigationItem.titleView?.setValue("lbl-header", forKeyPath: "accessibilityIdentifier")
I only have problems setting the identifier I have checked this post and it only touched on accesibilitylabel, one answer mentioned adding uilabel to the titleView, but I want to avoid it. and on this post, the answer says that
I don't think this is possible in SwiftUI using .accessibility(identifier:) - it might be worth submitting feedback to Apple.
and I want to know whether it's also an issue with UIKit? and is there a way around it without adding uiLabel?