List

public struct List<Content, Data, ID> : View where Content : View, ID : Hashable
extension List: Renderable

A list of elements that creates each subview on demand.

  • Declaration

    Swift

    public var viewStore: ViewValues
  • Declaration

    Swift

    public var body: View { get }
  • Declaration

    Swift

    public init(@ViewBuilder content: () -> View) where Content == Text, Data == String, ID == String
  • Creates a List that identifies its rows based on the id key path to a property on an underlying data element.

    Declaration

    Swift

    public init(_ data: [Data], id: KeyPath<Data, ID>, @ViewBuilder rowContent: @escaping (Data) -> View) where Content == ForEach<[Data], ID, HStack>
  • Listen to changes in the List’s content offset.

    Warning

    Updates to the value of this binding triggers high performance rendering when updating views. High performance updates don’t update children views of ScrollView and List. See High Performance in the documentation for more information.

    Not SiwftUI compatible.

    Also see: View.ignoreHighPerformance and View.skipHighPerformanceUpdate.

    Declaration

    Swift

    public func contentOffset(_ offset: Binding<CGPoint>) -> List<Content, Data, ID>
  • The estimated row height of the list

    Declaration

    Swift

    public func estimatedRowHeight(_ height: CGFloat) -> List<Content, Data, ID>
  • Will always reload the whole list on rendering updates instead of doing individual cell updates.

    Important

    Not SwiftUI compatible.

    Declaration

    Swift

    public func alwaysReloadData() -> List<Content, Data, ID>
  • Determines if the list can bounce.

    Important

    Not SwiftUI compatible.

    Declaration

    Swift

    public func bounces(_ bounces: Bool) -> List<Content, Data, ID>
  • Sets the separatorStyle for the list.

    Important

    Not SwiftUI compatible.

    Declaration

    Swift

    public func separatorStyle(_ separatorStyle: UITableViewCell.SeparatorStyle) -> List<Content, Data, ID>
  • Sets the content insets for the list.

    Important

    Not SwiftUI compatible.

    Declaration

    Swift

    public func contentInsets(_ insets: EdgeInsets, animated: Bool = false) -> List<Content, Data, ID>
  • Fires when a drag is started by the user.

    Important

    Not SwiftUI compatible.

    Declaration

    Swift

    public func onDragStarted(_ dragStarted: @escaping () -> Void) -> List<Content, Data, ID>
  • Fires when a drag is ended by the user.

    Important

    Not SwiftUI compatible.

    Declaration

    Swift

    public func onDragEnded(_ dragEnded: @escaping () -> Void) -> List<Content, Data, ID>
  • Updates this view during a high performance update.

    See High Performance Updates in the documentation for more information.

    Important

    Not SwiftUI compatible.

    Declaration

    Swift

    public func ignoreHighPerformance() -> List<Content, Data, ID>
  • Returns an instance of self with the specified list style.

    Declaration

    Swift

    public func listStyle(_ style: ListStyle) -> List<Content, Data, ID>

    Parameters

    style

    A style to apply. Pass a predefined instance of the types that conforms to ListStyle.

    Return Value

    An styled instance of self

  • Hides the vertical scroll indicator.

    Important

    Not SwiftUI compatible.

    Declaration

    Swift

    public func hidesIndicator() -> List<Content, Data, ID>
  • Sets if scrolling in this view is enabled or not.

    Important

    Not SwiftUI compatible.

    Declaration

    Swift

    public func scrollEnabled(_ enabled: Bool) -> List<Content, Data, ID>
  • Sets if scrolling is enabled, while still capturing user gestures. Use this instead of scrollEnabled if you want to start/stop receiving updates from user gestures while it’s being executed.

    Important

    Not SwiftUI compatible.

    Declaration

    Swift

    public func interactiveScrollEnabled(_ enabled: Bool) -> List<Content, Data, ID>
  • Makes the specified row visible. Once applied, the value inside the Binding will be set to nil.

    Important

    Not SwiftUI compatible.

    Declaration

    Swift

    public func appliedVisibleRow(_ row: Binding<ListVisibleRow?>) -> List<Content, Data, ID>

    Parameters

    offset

    The visible row to apply

  • Sets the keyboard dismiss mode of the ScrollView. If not set, by default it will be interactive.

    Important

    Not SwiftUI compatible.

    Declaration

    Swift

    public func keyboardDismissMode(_ dismissMode: UIScrollView.KeyboardDismissMode) -> List<Content, Data, ID>
  • Declaration

    Swift

    public func createView(context: Context) -> UIView
  • Declaration

    Swift

    public func updateView(_ view: UIView, context: Context)

Available where Data: Identifiable, Content == ForEach<[Data], String, HStack>, ID == Data.ID

  • Creates a List that computes its rows on demand from an underlying collection of identified data.

    Declaration

    Swift

    public init(_ data: [Data], @ViewBuilder rowContent: @escaping (Data) -> View)

Available where Data == Int, Content == ForEach<[Data], Int, HStack>, ID == Int

  • Creates a List that computes views on demand over a constant range.

    This instance only reads the initial value of data and so it does not need to identify views across updates.

    To compute views on demand over a dynamic range use List(_:id:content:).

    Declaration

    Swift

    public init(_ data: Range<Int>, @ViewBuilder rowContent: @escaping (Int) -> View)