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

menuIndicator(_:)

Sets the menu indicator visibility for controls within this view.

Declaration 宣言

func menuIndicator(_ visibility: Visibility) -> some View

Parameters パラメータ

visibility

The menu indicator visibility to apply.

Discussion 議論

Use this modifier to override the default menu indicator visibility for controls in this view. For example, the code below creates a menu without an indicator:


Menu {
    ForEach(history , id: \.self) { historyItem in
        Button(historyItem.title) {
            self.openURL(historyItem.url)
        }
    }
} label: {
    Label("Back", systemImage: "chevron.backward")
        .labelStyle(.iconOnly)
} primaryAction: {
    if let last = history.last {
        self.openURL(last.url)
    }
}
.menuIndicator(.hidden)

See Also 参照

Visibility