init(_:image:isInserted:content:)
Creates a menu bar extra with an image to use as the items label. The provided title will be used by the accessibility system.
Declaration
nonisolated init(_ titleKey: LocalizedStringKey, image: ImageResource, isInserted: Binding<Bool>, @ViewBuilder content: () -> Content)Parameters
- titleKey:
The localized string key to use for the accessibility label of the item.
- image:
The image resource to use as the label.
- isInserted:
Whether the item is inserted in the menu bar. The item may or may not be visible, depending on the number of items present.
- content:
A
Viewto display when the user selects the item.
Discussion
The item will be displayed in the system menu bar when the specified binding is set to true. If the user removes the item from the menu bar, the binding will be set to false.