SwiftUI NavigationView 插入符号位置

SwiftUI NavigationView caret position

希望找到一种方法使 NavigationView 插入符号与行的右上角对齐而不是居中。希望找到一种方法让插入符号与我的文章标题一致。

List {
    ForEach(searching ? faqTableSearch : faqTable) { section in
        Section(header: Text(section.section)) {
            ForEach(section.faq) { row in
                NavigationLink(destination: FaqView(title: row.title, summary: row.summary, content: row.body)) {
                    VStack {
                        Text(row.title)
                            .font(.custom("Helvetica", size: 16))
                            .foregroundColor(Color(UIColor.systemGray))
                            .offset(x: -16)
                        Spacer()
                        Text(row.summary)
                            .font(.custom("Helvetica", size: 12))
                            .foregroundColor(Color(UIColor.systemGray))
                            .offset(x: 16)
                    }
                } // end nav
            } // end item
        } // end section
        .font(.custom("Helvetica", size: 17))
    } // end loop
}

我认为您不能在 NavigationView 中移动由 NavigationLink 创建的标准人字形,但您可以隐藏默认 NavigationLink 并使用(非常略有不同的 SF 符号 chevron.rightchevron.forward):

struct ContentView: View {
    var items = ["Item 1", "Item 2", "Item 3"]
    
    var body: some View {
        NavigationView {
            List {
                ForEach(items, id: \.self) { item in
                    ZStack {
                        NavigationLink(destination: Text("Detail")) { EmptyView() }.hidden()
                        VStack(alignment: .leading) {
                            HStack {
                                Text(item)
                                    .font(.custom("Helvetica", size: 16))
                                    .offset(x: -16)
                                Spacer()
                                Image(systemName: "chevron.right")
                            }.foregroundColor(Color(UIColor.systemGray))
                            
                            Spacer()
                            Text(item)
                                .font(.custom("Helvetica", size: 12))
                                .foregroundColor(Color(UIColor.systemGray))
                                .offset(x: 16)
                        }
                    }
                }
            }
        }
    }
}

Image(systemName: "chevron.right").font(.system(size: 14)).opacity(0.3)

enter image description here

var body: some View {
    NavigationView {
        List {
            Section(header: GroupHeader(title: "Example")) {
               NavigationLink(
                    destination: UnderlineTextField_Example(),
                    label: {
                        Text("TextField")
                    }
                )
                
                HStack {
                    Button("Navigation") {
                        isPresented.toggle()
                    }
                    .fullScreenCover(isPresented: $isPresented) {
                        TabNavigation()
                    }
                    
                    Spacer()
                    
                    Image(systemName: "chevron.right")
                        .font(.system(size: 14))
                        .opacity(0.3)
                }
        }
}