Contents

menuIndicator(_:)

Sets the menu indicator visibility for controls within this view.

Declaration

nonisolated 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

Showing a menu indicator