1

I have the problem that the arrows are always shown with. i have tried things like .buttonsytel(PlainButtonStyle()) or similar. Also with .frame(0).opacity(0), or .hidden, but nothing was displayed. How can I hide the arrows?

List {
                    ForEach(projectListVM.projects, id: \.id) { project in
                        NavigationLink(destination: ProjectTabViewScreen(project: project)){
                         
                            ProjectListCardDesign(project: project)
 }
                        .listRowSeparator(.hidden)
                            
                            
                    }.onDelete(perform: deleteProject)
            }.listStyle(.plain)

import SwiftUI

struct ProjectListCardDesign: View {
    
    let project: ProjectViewModel
    
    
   
    
    var body: some View {
        
        HStack {
            if !project.symbol.isEmpty {
                Image(systemName: project.symbol)
                    .font(.largeTitle)
                    .padding(.all, 10)
                    .background(Color.blue.opacity(0.2))
                    .clipShape(Circle())
                    .padding(.trailing, 10)
            }
            
            VStack(alignment: .leading, spacing: 5) {
                Text(project.title)
                    .font(.title3)
                    .fontWeight(.bold)
                    .foregroundColor(.primary)
                    
                if !project.info.isEmpty {
                    Text(project.info)
                        .font(.caption)
                        .foregroundColor(.secondary)
                }
            }
            Spacer()
            
            VStack {
                

                switch project.prio {
                case 1:
                    RoundedRectangle(cornerRadius: 10)
                        .fill(Color.clear)
                        .frame(width: 15, height: 40)
                case 2:
                    RoundedRectangle(cornerRadius: 10)
                        .fill(Color.green)
                        .frame(width: 15, height: 40)
                case 3:
                    RoundedRectangle(cornerRadius: 10)
                        .fill(Color.orange)
                        .frame(width: 15, height: 40)
                case 4:
                    RoundedRectangle(cornerRadius: 10)
                        .fill(Color.red)
                        .frame(width: 15, height: 40)
                default:
                    RoundedRectangle(cornerRadius: 10)
                        .fill(Color.clear)
                        .frame(width: 15, height: 40)
                }
            }
            .padding(.leading, 10)
        }
        .padding()
        .background(Color(.systemGray6))
        .cornerRadius(15)
        .shadow(color: Color.black.opacity(0.2), radius: 7, x: 0, y: 2)      
        
    }
}

What could be the reason? I have already tried everything. Entweder es hat sich nichts geƤndert, oder es wurde gar nichts mehr angezeigt.

1 Answers1

0

Just removing the chevron is not standard behaviour. But if you still want to do it, then use the NavigationLink inside a .background() modifier like so.

NavigationStack{
    List {
        ForEach(projectListVM.projects, id: \.id) { project in
            ProjectListCardDesign(project: project)
                .background (
                    NavigationLink("", destination: ProjectTabViewScreen(project: project))
                )
                .listRowSeparator(.hidden)
         }.onDelete(perform: deleteProject)
    }.listStyle(.plain)
}

In this case, the NavigationLink will be in the background of the List item. The empty String "" inside the NavigationLink is needed to have a Label. This works now like you expect without having to show a chevron

bennyyy999
  • 80
  • 1
  • 5