I want to use Foreach and NavigationLink with SfSymbol for menu

I want to use Foreach and NavigationLink with SfSymbol for menu where each rectangle comes out SFSymbol differently and be able to link to the different View.

HStack()

                    {
                        ForEach(MockData.items)
                        {item in
                            
                            //NavigationLink(
                            
                            RoundedRectangle(cornerRadius: 10 )
                                .frame(width: 70, height: 70)
                                .foregroundStyle(item.color.gradient)
                            
                            
                            
                        }
                        
                        
                        
                        
                        
                    }//scrollview
                    
                    //opciones
                    
                    
                    
                }//cierre del VStack
                
                .padding(.top, 20)
                .padding(.leading)
                Spacer()
            }//cierre Zstack
            
            
            
        } //cierre de Zstack
        .navigationTitle("Caracteristicas")
        
        
        
        
        
        
        .toolbar{
            ToolbarItem(placement: .navigationBarLeading)
            {
                
                Button(action:{},
                       label: {
                    
                    
                    Image(systemName: "switch.2")})
                
            }
            
            ToolbarItem(placement: .navigationBarTrailing)
            {
                Button(action:{},
                       label: {Image(systemName: "person.circle")})
            }
            
        }//toolBar
        
        
        .accentColor(.red)
        
        
        
        
    }
    
    
    
}

}

    struct Item: Identifiable {
        
        let id = UUID()
        let color: Color
        let image: String
       
    }
            
    struct MockData {
        static var items = [Item(color: .red, image:"heart" ),
                            Item(color: .blue, image:"pill"),
                            Item(color: .orange, image: "syringe"),
                            Item(color: .green, image:"microbe"),
                            Item(color:.purple, image: "allergens")]
    }
        

I need help figuring out how to do it.

Answered by Stokestack in 783721022
ZStack
{
	RoundedRectangle(cornerRadius: 10 )
		.frame(width: 70, height: 70)
		.foregroundStyle(item.color.gradient)

	Image(systemName: item.image)
}

Have you tried that?

Accepted Answer
ZStack
{
	RoundedRectangle(cornerRadius: 10 )
		.frame(width: 70, height: 70)
		.foregroundStyle(item.color.gradient)

	Image(systemName: item.image)
}

Have you tried that?

I want to use Foreach and NavigationLink with SfSymbol for menu
 
 
Q