ListCell SwiftUI - admiral-team/admiralui-ios GitHub Wiki

Class

A view that displays leading, trailing and image views


Declaration

public struct ListCell<L, C, T>: ListViewCell where L: View , C: View, T: View

Overview

ListCell allows you to dynamically build cells by leading, center and trailing rules.

Live example

Configure a ListCell with center element:

 ListCell<EmptyView, SubtitleTitleListView, EmptyView>(
     centerView: {
         SubtitleTitleListView(
             title: "Title",
             subtitle: "Subtitle"
         )
     }
 )

Configure a ListCell with center and trailing elements:

ListCell(
  centerView: { TitleListView(title: item.title) },
  trailingView: { ArrowListView() }
)

You can also control highlighting by adding isHighlighted property:

ListCell(
  centerView: { TitleListView(title: item.title) },
  trailingView: { ArrowListView() },
  isHighlighted: .constant(true)
)

Configure a ListCell with leading, center and trailing elements:

ListCell(
   leadingView: { ImageCardListView(cardImage: Image(uiImage: Asset.Card.rnb.image)) },
   centerView: { TitleListView(title: "Title") },
   trailingView: { IconListView(image: Image(uiImage: Asset.Card.rnb.image)) }
)

You can also mark cell as selected by adding isSelected property:

ListCell(
   leadingView: { ImageCardListView(cardImage: Image(uiImage: Asset.Card.rnb.image)) },
   centerView: { TitleListView(title: "Title") },
   trailingView: { IconListView(image: Image(uiImage: Asset.Card.rnb.image)) },
   isSelected: .constant(false)
)

Contribution

You can help us to find bugs or ask us to add features.

  • To start issue please use ready-made templates.
  • To make changes to the repository, you need to create a fork of the project, make changes to the code and create a pull request in our project. You can read more about this in the Github documentation.
⚠️ **GitHub.com Fallback** ⚠️