How to change ListStyle in List

后端 未结 3 993
你的背包
你的背包 2021-02-05 06:42

In SwiftUI List Appears to have a property called ListStyle.

How can i change the style of the list

struct ListView : View {         


        
3条回答
  •  抹茶落季
    2021-02-05 06:58

    As of Xcode 11 beta 5, Apple requires the following, as briefly outlined here:

    .listStyle(GroupedListStyle())
    

    The following is breakdown on the various styles and where they can be used between iOS and watchOS, along with when they were introduced.

    iOS and watchOS

    Introduced with iOS 13 and watchOS 6:

    • PlainListStyle

    • ListStyle

    • DefaultListStyle

    iOS Only

    Introduced with iOS 13:

    • GroupedListStyle

    Introduced with iOS 14:

    • InsetGroupedListStyle
    • InsetListStyle
    • SidebarListStyle

    Some answers to this question also include styles that are watchOS specific, but are not clearly marked as such, despite the question being tagged iOS. For completeness...

    watchOS Only

    Introduced with watchOS 6:

    • CarouselListStyle

    Introduced with watchOS 7:

    • EllipticalListStyle

提交回复
热议问题