Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 803
Super Noob Avatar asked Feb 04 '23 14:02

Super Noob


1 Answers

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
like image 195
Asperi Avatar answered May 16 '23 08:05

Asperi