SwiftUI 2.0中的navigationBarTitle和navigationTitle有什么区别?

时间:2020-10-04 09:22:30

标签: swiftui

我不了解navigationBarTitle()和navigationTitle()之间的确切区别。有人可以解释何时使用哪种吗?

1 个答案:

答案 0 :(得分:2)

navigationTitle只是SwiftUI 2.0的替代品,已弃用的SwiftUI 1.0 navigationBarTitle

@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