Structure

TabView

A view that switches between multiple child views using interactive user interface elements. あるビュー、それは複数の子ビューの間を切り替えます、対話式ユーザインターフェイス要素を使います。

Declaration 宣言

struct TabView<SelectionValue, Content> where SelectionValue : Hashable, Content : View

Overview 概要

To create a user interface with tabs, place views in a TabView and apply the tabItem(_:) modifier to the contents of each tab. On iOS, you can also use one of the badge modifiers, like badge(_:), to assign a badge to each of the tabs. The following creates a tab view with three tabs, the first of which has a badge:


TabView {
    Text("The First Tab")
        .badge(10)
        .tabItem {
            Image(systemName: "1.square.fill")
            Text("First")
        }
    Text("Another Tab")
        .tabItem {
            Image(systemName: "2.square.fill")
            Text("Second")
        }
    Text("The Last Tab")
        .tabItem {
            Image(systemName: "3.square.fill")
            Text("Third")
        }
}
.font(.headline)

Tab views only support tab items of type Text, Image, or an image followed by text. Passing any other type of view results in a visible but empty tab item. 何らかの他の型のビューを渡すことは、ある変数しかし空のタブ項目という結果になります。

Topics 話題

Creating a Tab View タブビューを作成する

Styling Tab Views

Supporting Types 支援を行う型

Default Implementations 省略時実装

Relationships 関係

Conforms To 次に準拠