How to put checkmark when Menu item selected SwiftUI

Im trying to put checkmark when menu item selected.I tried give a @State var selectedSort : Int = .zero and give id(selectedSort) but It didn't work. How can I solve this problem ?
This is my code;

Code Block struct SortMenuPickerView : View {
    
    @Binding var sortClicked : Bool
    @ObservedObject var productListViewModel = ProductListViewModel()
    @State var sortListArray : [ProductListSortAndFilterList]
    var function: () -> Void
    @Binding var sortId : String
    
    var body : some View {
        
        HStack(alignment: .center){
            
            Spacer()
            
            Menu {
                
                ForEach(sortListArray,id:\.id){ item in
                    if item.id == "sort" {
                        
                        ForEach(item.sortList ?? [],id:\.id) { data in
                            
                            Button(action: {
                                
                                sortId = (data.id ?? "")
                                
                                self.function()
                                
                                print("selected item is : \(data.id!)")
                                
                                
                            }) {
                                
                                Text(data.name ?? "")
                                    .tag(data.id)
                                
                            }
                        }
                    }
                }
            } label: {
                
                SortView()
                
            }


You would use a Picker.

For example:
Code Block Swift
Picker("Menu picker", selection: $selection) {
ForEach(1..<5, id: \.self) { number in
Label("\(number)", systemImage: "\(number).circle")
}
}
.pickerStyle(MenuPickerStyle()) // makes the picker appear as a menu

If you want the picker to be embedded inside the menu do this:
Code Block Swift
Menu("Picker inside menu") {
Text("Menu item 1")
Text("Menu item 2")
Divider()
Picker(...) { ... }
.pickerStyle(MenuPickerStyle()) // apply this if you want the picker to show as a sub-menu
}

How to put checkmark when Menu item selected SwiftUI
 
 
Q