Modifier is unavailable that setting a custom view as navigation title, deprecated or bug?

As shown in the documentation, this method is marked available for iOS 14+ [Beta].

Configures the view’s title for purposes of navigation, using a custom view.

Code Block swift
func navigationTitle<V>(_ title: () -> V) -> some View where V : View


However, when use it in a view, the compiler warns it is not available.

Code Block swift
body: some View {
Text("Hello, world!")
.navigationTitle {
SomeCustomView()
// Or even Text("some title")
}
}


Is it a bug or a removed api with outdated documentation?
The documentation of func navigationTitle<V>(_ title: () -> V) -> some View where V : View clearly shows it's only available for watchOS 7.0+.

navigationTitle(_:)

Availability

watchOS 7.0+ Beta
Xcode 12.0+ Beta
You can use another version of navigationTitle with a little change when the title is a Text.

navigationTitle(_:)

Declaration

func navigationTitle(_ title: Text) -> some View

Availability

iOS 14.0+ Beta
macOS 11.0+ Beta
tvOS 14.0+ Beta
watchOS 7.0+ Beta
Xcode 12.0+ Beta
Code Block
var body: some View {
Text("Hello, world!")
.navigationTitle(Text("some title"))
}


@OOPer,

The referred doc of yours is SceneKit instead of SwiftUI.

In SwiftUI, for example,

https://developer.apple.com/documentation/swiftui/hstack/navigationtitle(_:)-4urrw

https://developer.apple.com/documentation/swiftui/zstack/navigationtitle(_:)-9668j

etc. etc.

Availability
iOS 14.0+ Beta
macOS 11.0+ Beta
Mac Catalyst 14.0+ Beta
tvOS 14.0+ Beta
watchOS 7.0+ Beta
Framework
SwiftUI
The importance of navigationTitle(View) api is that, without it we lost the ability to customize the navigation bar. We are therefore limited to only string in the title bar. Even Text(Image(systemName:)) is unsupported!

I can understand the reason only allow string in the title bar, that to work with macOS.
However, we should not give up the ability to use customize view in the navigation bar title area for iOS and iPadOS.

It is much better to simply allow customized view in iOS and ipadOS. And for those unsupported like macOS, fallback to pure string.

If in case navigationTitle(View) is dropped, then in most production app, developers will have to workaround the problem by giving up the built-in NavigationBar by always setting it to hidden. Then manually implement their own version of navigation bar.


The referred doc of yours is SceneKit instead of SwiftUI.

Thanks for correcting my mistake. You are right the doc says it is available for iOS 14.0+.

Have you written a feedback for this issue? That may prompt Apple people to support the method in time for the released version of Xcode.
You can use Toolbar item to place custom view as navigation bar title

Code Block
.toolbar {
    ToolbarItem (placement: .status) {
<Your View>
}
}

Modifier is unavailable that setting a custom view as navigation title, deprecated or bug?
 
 
Q