「Introduction to SwiftUI - WWDC 2020 - Videos - Apple Developer」
に、以下のようなコードが出てくる。
.navigationTitle("Sandwiches")
.toolbar {
#if os(iOS)
EditButton()
#endif
Button("Add", action: makeSandwich)
}
サンプルの映像には、上部のナビゲーションバーアイテムに、「Add」と「Edit」のボタンが表示されるが、
実際に設定してみると、画面下のツールバーの位置に表示される。
なので、以下のようにすると、似たようなことができた。
.navigationBarItems(
leading: Button("Add", action: makeSandwich)
,trailing: Group {
#if os(iOS)
EditButton()
#endif
}
)