How to Hide Disclosure Indicator in SwiftUI List

SwiftUI has made it very easy for developers to create a list view, similar to a table view in UIKit. When working with table view in UIKit, you can easily configure a cell’s indicator by setting the accessoryType property. For example, to disable the disclosure indicator, you set the property to .none like this:

In SwiftUI, it seems Apple doesn’t offer an API to configure the disclosure indicator in the list view. In this short tutorial, I will show you a workaround to hide disclosure indicators if you need to.

Editor’s note: If you are new to SwiftUI, you can check out our series of SwiftUI tutorials here.

Let’s begin with a simple list view:

If you run the code in the preview pane, you will see the list view showing a list of text items. Tapping any of the items will bring you to the detailed view.


As you can see, when adopting NavigationLink, the built-in list view automatically displays a disclosure indicator in each row of data. The question is how you can hide or remove the indicator.

Hiding Disclosure Indicator

Both the List view and NavigationLink do not come with a modifier for you to configure the appearance of the disclosure indicator. To hide the indicator, you can modify the code like below:

The trick is to embed the NavigationLink and Text view in a ZStack. For the navigation link, instead of presenting the Text view, we change it to display an empty view. And, we attach the opacity modifier to NavigationLink and set its value to 0.

If you test the change in the preview, the disclosure indicator should disappear.


I hope you find this workaround useful. Feel free to leave me a comment if you have any questions.

A Look at the WebKit Framework – Part 1
Learn SwiftUI Using Swift Playgrounds for iPad and Mac
Core Data Part 2: Update, Delete Managed Objects and View Raw SQL Statement