Categories
SwiftUI SwiftUI List

SwiftUI List.listStyle examples with screenshots

In SwiftUI, there are serval styles with List. They are DefaultListStyle, InsetListStyle, GroupedListStyle, InsetGroupedListStyle, SidebarListStyle and PlainListStyle.

I made an example for all these styles, and take screenshots to help you understand them easily.

DefaultListStyle
GroupedListStyle
InsetListStyle
InsetGroupedListStyle
SidebarListStyle
PlainListStyle
Note:
  • InsetListStyle, InsetGroupedListStyle, SidebarListStyle are only available on iOS 14.0 and after.
  • And when you put a List in a NavigationView with navigationBarItems, it will automate change List style to something like GroupedListStyle without any codes, you can set listStyle to DefaultListStyle to undo it.
Codes:

Leave a Reply

Your email address will not be published. Required fields are marked *