LoginSignup
5
4

More than 3 years have passed since last update.

SwiftUI に新規追加:セクション(グループ)内のコンテンツの表示・非表示に DisclosureGroup を使用

Last updated at Posted at 2020-07-17

WWDC 2020で紹介された DisclosureGroup を使えば、SwiftUI コンテンツのセクション(グループ)の表示・非表示が行えます。

スクリーンショット

struct ContentView: View {

    @State var catMenuExpanded: Bool = false
    @State var dogMenuExpanded: Bool = false

    var body: some View {

        DisclosureGroup("私の猫たち", isExpanded: $catMenuExpanded) {
            Text("ネコノヒー")
            Text("ムギ")
            Text("レオ")
        }.padding()

        DisclosureGroup("私の犬たち", isExpanded: $dogMenuExpanded) {
            Text("アズキ")
            Text("マメ")
        }.padding()

    }

}

:relaxed: Twitter @MszPro

:sunny: 私の公開されているQiita記事のリストをカテゴリー別にご覧いただけます。

5
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
4