GenericController

public class GenericController<T: GenericCell<ModelType>, ModelType>: UITableViewController,
UISearchResultsUpdating, UISearchControllerDelegate

Generic Controller

  • The item list to be displayed

    Declaration

    Swift

    public var items: [ModelType] { get set }
  • The filtered items

    Declaration

    Swift

    public var filteredItems: [ModelType]
  • Event handler to indicate if the item cell should be marked

    Declaration

    Swift

    public var shouldMarkCellAction: ((_ value: ModelType) -> Bool)?
  • Delegate to customise the filter content.

    Declaration

    Swift

    public var filterContentForSearchTextAction: ((_ items: [ModelType], _ searchText: String) -> [ModelType])? { get set }
  • The typealias for event handler to return the item selected

    Declaration

    Swift

    public typealias SelectedHandler = (_ value: ModelType) -> Void
  • Event handler to return the item selected

    Declaration

    Swift

    public var selectedHandler: SelectedHandler?

Private properties

  • Called after the view controller has loaded its view hierarchy into memory.

    Declaration

    Swift

    override public func viewDidLoad()
  • Notifies the view controller that its view is about to be added to a view hierarchy.

    Declaration

    Swift

    override public func viewWillAppear(_ animated: Bool)
  • UIKit calls this method before changing the size of a presented view controller’s view

    Declaration

    Swift

    override public func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator)

    Parameters

    size

    The new size for the container’s view.

    coordinator

    The transition coordinator object managing the size change.

  • Called when the search controller is automatically dismissed.

    Declaration

    Swift

    public func didDismissSearchController(_ searchController: UISearchController)
  • Returns number of items

    Declaration

    Swift

    override public func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int
  • Displays the retrieved items

    Declaration

    Swift

    override public func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell

UITableViewDelegate

  • Returns headerview

    Declaration

    Swift

    override public func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView?
  • Returns height of headerview

    Declaration

    Swift

    override public func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat
  • Declaration

    Swift

    override public func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat
  • To select the items

    Declaration

    Swift

    override public func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath)

UISearchResultsUpdating

  • To update search result

    Declaration

    Swift

    public func updateSearchResults(for searchController: UISearchController)