struct DevTechieRemoveDisclosureExample: View { var devTechieCourses = [ "Mastering SwiftUI 3", "Machine Learning in iOS", "Goals app in SwiftUI", "E-Commerce App in SwiftUI 3" ] var body: some View { } }
struct DevTechieRemoveDisclosureExample: View { var devTechieCourses = [ "Mastering SwiftUI 3", "Machine Learning in iOS", "Goals app in SwiftUI", "E-Commerce App in SwiftUI 3" ] var body: some View { NavigationView { List(devTechieCourses, id: \.self) { course in NavigationLink(destination: Text(course)) { Text(course) } } .navigationTitle("DevTechie Courses") } } }
List(devTechieCourses, id: \.self) { course in ZStack { NavigationLink(destination: Text(course)) { Text(course) } } }
List(devTechieCourses, id: \.self) { course in ZStack { Text(course) NavigationLink(destination: Text(course)) { EmptyView() } } }
List(devTechieCourses, id: \.self) { course in ZStack(alignment: .leading) { Text(course) NavigationLink(destination: Text(course)) { EmptyView() } .opacity(0.0) } }
Notice that the disclosure indicator is not there anymore.
struct ListCell: View { var title: Stringvar body: some View { ZStack(alignment: .leading) { HStack { Image(systemName: "books.vertical.fill") Text(title) Spacer() Image(systemName: "rectangle.trailinghalf.inset.filled.arrow.trailing") } NavigationLink(destination: Text(title)) { EmptyView() } .opacity(0.0) } .frame(height: 50) .padding(.horizontal) .background(Color.orange.gradient, in: RoundedRectangle(cornerRadius: 20)) .foregroundColor(.white) .listRowSeparator(.hidden) } }
struct DevTechieRemoveDisclosureExample: View { var devTechieCourses = [ "Mastering SwiftUI 3", "Machine Learning in iOS", "Goals app in SwiftUI", "E-Commerce App in SwiftUI 3" ] var body: some View { NavigationView { List(devTechieCourses, id: \.self) { course in ListCell(title: course) } .listStyle(.plain) .navigationTitle("DevTechie Courses") } } }
With that we have reached the end of this article. Thank you once again for reading. Don’t forget to follow 😍. Also subscribe our newsletter at https://www.devtechie.com