Super Noob
Super Noob

Reputation: 870

What is the difference between navigationBarTitle and navigationTitle modifiers in SwiftUI 2.0?

Learning all the new SwiftUI 2.0 changes but came across .navigationTitle which seems to work almost exactly like .navigationBarTitle. I looked at the WWDC 2020 videos and found one video where it was mentioned as being used to distinguish tab titles in MacOS? But not sure if it I should use it now instead of .navigationBarTitle in iOS? Also the Apple documentation is not clear about the differences between the two..

So my question is, what are the exact differences and how would you use them in iOS/MacOS?

Upvotes: 12

Views: 2768

Answers (1)

Asperi
Asperi

Reputation: 258345

The navigationBarTitle is just deprecated and renamed to navigationTitle:

@available(iOS, introduced: 13.0, deprecated: 100000.0, renamed: "navigationTitle(_:)")
@available(macOS, unavailable)
@available(tvOS, introduced: 13.0, deprecated: 100000.0, renamed: "navigationTitle(_:)")
@available(watchOS, introduced: 6.0, deprecated: 100000.0, renamed: "navigationTitle(_:)")
public func navigationBarTitle(_ title: Text) -> some View

Upvotes: 17

Related Questions