Instance Method インスタンスメソッド

navigationBarTitle(_:)

Sets the title in the navigation bar for this view. このビューのナビゲーションバーにおけるタイトルを設定します。

Declaration 宣言

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

Parameters パラメータ

title

A description of this view to display in the navigation bar. ナビゲーションバーにおいて表示するためのこのビューの説明。

Discussion 議論

Use navigationBarTitle(_:) to set the title of the navigation bar. This modifier only takes effect when this view is inside of and visible within a NavigationView.

The example below shows setting the title of the navigation bar using a Text view:


struct FlavorView: View {
    let items = ["Chocolate", "Vanilla", "Strawberry", "Mint Chip",
                 "Pistachio"]
    var body: some View {
        NavigationView {
            List(items, id: \.self) {
                Text($0)
            }
            .navigationBarTitle(Text("Today's Flavors"))
        }
    }
}

A screenshot showing the title of a navigation bar configured using a

See Also 参照

Auxiliary View Modifiers