Description: An animated menu picker in SwiftUI, using MatchedGeometryEffects.
Define a liste of MenuPicker.Choice
private let choices = [
MenuPicker.Choice(id: UUID().uuidString, title: "Home"),
MenuPicker.Choice(id: UUID().uuidString, title: "Pictures"),
MenuPicker.Choice(id: UUID().uuidString, title: "Videos"),
MenuPicker.Choice(id: UUID().uuidString, title: "Documentation")
]
Define a state variable for the selected value
@State private var selectedChoice: MenuPicker.Choice?
Call the MenuPicker
View with these properties
MenuPicker(
choices: choices,
selected: $selectedChoice
)