When making a List with a row that pushes to a new view, SwiftUI adds a disclosure indicator \">\" automatically? How do I remove it if I don\'t want it?
Once you put your button in a scrollview, the disclosure button will be hidden. Just make sure to disable your scroll indicator.
Setting the NavigationLink width and hiding it did the trick for me
List {
ForEach(pages) { page in
HStack {
Text("Something")
NavigationLink(destination: Text("Somewhere")) {
EmptyView()
}
.frame(width: 0)
.opacity(0)
}
}
}
This helps to push and pass the model to the next navigation view controller.
struct ContentView : View {
@State var model = PostListViewModel()
var body: some View {
NavigationView {
List(model.post) { post in
ListCell(listData: post)
}.navigationBarTitle(Text("My Post"))
}
}
}
struct ListCell: View {
var listData: Post
var body: some View {
return NavigationButton(destination: DetailContentView(post: listData)) {
HStack {
ImageRow(model: listData) // Get image
VStack(alignment: .leading) {
Text(listData.login).font(.headline).lineLimit(nil)
Text(listData.url).font(.subheadline).lineLimit(nil)
}.padding(.leading, 10)
}.padding(.init(top: 5, leading: 0, bottom: 5, trailing: 0))
}
}
}
The easiest one. The content for each item in the list.
ZStack {
NavigationLink(destination: DetailView()) {
EmptyView()
}.hidden()
RowView()
}