Why list menu items not shown in SwiftUI project?

I have list item menu project in SwiftUI, my project work, but I have list icons, they are not shown in list view, even I was try to use system image, there is not any change on screen, any idea?

Code Block struct MasterView: View {
let view1 = Menu(name:"Home", image:"image_home", destination:.home)
let view2 = Menu(name:"View 1", image:"image_view1", destination:.view1)
let view3 = Menu(name:"View 3", image:"image_view2", destination:.view2)
var body: some View {
let menus: [Menu] = [view1, view2, view3]
return List {
ForEach(menus) { menu in
self.destinationView(menu: menu)
}}}
func destinationView(menu: Menu) -> some View {
switch menu.destination {
case .view1:
return NavigationLink(
destination: AnyView(View1(menu: menu))
)
{
Text("\(menu.name)")
}
case .view2:
return NavigationLink(
destination: AnyView(View2(menu: menu))
)
{
Text("\(menu.name)")
}
default:
return NavigationLink(
destination: AnyView(HomeView(menu: menu))
)
{
Text("\(menu.name)")
}}}}

Model.swift:
Code Block /// Main menu item for the list
struct Menu: Identifiable {
var id = UUID()
var name: String
var image: String
var destination: ViewType
}
enum ViewType {
case home
case view1
case view2
}


I noticed similar problems with List.

First try to replace by VStack, just to check.
If that works, that is a List problem.

If not, maybe problem with images.
Did you put them in xcassets ?


yes ,I put in xcassets icons, even ı was chabge with different icons. I guess it is commulated in list view with text. I do not know how solve it
I put VStack to where, if u show , I will be appreciated.
I would try to replace here:

Code Block
return List {
ForEach(menus) { menu in
self.destinationView(menu: menu)
}}}

with
Code Block
return Stack {
ForEach(menus) { menu in
self.destinationView(menu: menu)
}}}


If that works, you should file a bug… and close the thread.

tnx, I try but nothing change
Why list menu items not shown in SwiftUI project?
 
 
Q