问题
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?
回答1:
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
来源:https://stackoverflow.com/questions/63735226/what-is-the-difference-between-navigationbartitle-and-navigationtitle-modifiers