init(_:)
Creates a menu based on a style configuration.
Declaration
nonisolated init(_ configuration: MenuStyleConfiguration)Discussion
Use this initializer within the makeBody(configuration:) method of a MenuStyle instance to create an instance of the menu being styled. This is useful for custom menu styles that modify the current menu style.
For example, the following code creates a new, custom style that adds a red border around the current menu style:
struct RedBorderMenuStyle: MenuStyle {
func makeBody(configuration: Configuration) -> some View {
Menu(configuration)
.border(Color.red)
}
}