BaseTableViewController

open class BaseTableViewController : DataBasedViewController

Provides a basic TableViewController capable of perform data synchronization operations.

  • Refresh control used to provide user feedback. Can be created by overriding createRefreshControl().

    Declaration

    Swift

    open var refreshControl: UIRefreshControl?
  • Reference to the table view itself.

    Declaration

    Swift

    @IBOutlet
    open weak var tableView: UITableView?
  • TableView’s DataSource. Can be created by overriding createDataSource().

    Declaration

    Swift

    open var dataSource: UITableViewDataSource?
  • TableView’s DataSource. Can be created by overriding createDelegate().

    Declaration

    Swift

    open var delegate: UITableViewDelegate?
  • Called when view is loaded. If tableView is defined, setups it by calling setupTableView().

    If this class implements UITableViewDataSource, sets ifself as datasource. Else, calls createDataSource() and sets the returned data source as tableview’s data source.

    If this class implements UITableViewDelegate, sets ifself as delegate. Else, calls createDelegate() and sets the returned data source as tableview’s delegate.

    Finally, if createRefreshControl() returns an object, sets it as tableview’s refresh control.

    Declaration

    Swift

    override open func viewDidLoad()
  • Called when view is will become not visible. Deselect’s selected tableview’s row.

    Declaration

    Swift

    override open func viewWillDisappear(_ animated: Bool)
  • Data synchronization was completed.

    If a refresh control is being used, ends its refreshing.

    Declaration

    Swift

    override open func didSyncData()
  • Setups the TableView (manually register cells, etc). By default, does nothing.

    Declaration

    Swift

    open func setupTableView()
  • Create the DataSource to be used by the TableView.

    By default, returns nil.

    Declaration

    Swift

    open func createDataSource() -> UITableViewDataSource?
  • Create the Delegate to be used by the TableView.

    By default, returns nil.

    Declaration

    Swift

    open func createDelegate() -> UITableViewDelegate?
  • Creates the refresh control to be used by the TableView.

    By default, returns nil.

    Declaration

    Swift

    open func createRefreshControl() -> UIRefreshControl?