List View Controller

Description

The GSDListViewController is a extension of TableViewController which allows the developer to quickly display a set of objects.

Basic Usage

Althoung the ListController is based on the TableViewController, it's API has been simplified. Most of the information needed by the TableView is provided automatically by the SDK, so the developer work is much easier. To show the list of the objects one must provide the object which conforms to "GSDListViewDataSourceDelegate" protocol, and returns the configuration for specific row. The number of rows and sections is by default calculated based on "Items" property. This property is the list of objects which should be displayed.

Example:

1
2
3
4
5
6
7
8
class ExampleObject: GSDListViewDataSourceDelegate {
    func listView(_ tableView: UITableView, configFor indexPath: IndexPath) -> GSDListViewCellConfiguration? {

        let tempConfiguration = GSDListViewCellConfiguration()
        tempConfiguration.title = "title"
        tempConfiguration.details = "detail"
        return tempConfiguration
    }

GSDListViewCellConfiguration

GSDListViewCellConfiguration is a configuration class which defines the behaviour and the look of each row in the list.

  • title - the displayed title of the row
  • details - the detailed information in the row
  • image - the icon displayed on the right side of cell
  • switchState - the state od the switch action view
  • buttonText - the title of button action view
  • buttonImage - the image of the button action view
  • actionConfiguration - the action view in the row
  • infoViewConfiguration - the configuration according to which the information inside the cell will be displayed
  • gestureRecognizerConfiguration - the gesture recognizer added to cell