StateUITableView 1.0.1

StateUITableView 1.0.1

1985wasagoodyear 维护。



  • 名称
StateTableView
October 22, 2018
Kevin Yu
Version 10.0 (10A255)


Inspired by this article here:
https://www.raywenderlich.com/5542-enum-driven-tableview-development

Idea:
-   A custom TableView class to handle the various states of a tableView with loading,
    error, empty, and normal properties.
-   Avoids the issues of multiple decision trees in each of a TableViewDataSource's
    delegate methods (which can become a mess)
-   Easily adoptable
-   Protocol-based?
-   I dunno what else


Concept of connections:

-   some ViewController/DataSource/etc with a TableView
-   some manager that handles networking/loading data/etc
-   some TableView (that this subclasses)

How it works:

-   some VC creates a TableView and subclasses it as StateTableView
-   VC sets delegates for protocol and errorProtocol
-   StateTableView is the TableViewDataSource for the tableView but if there is data,
    it asks the VC's TableViewDataSource methods via delegate chaining
-   Shows different errors otherwise, via ErrorProtocol or by default

Concerns / Areas to Improve:

-   is it thread-safe?
-   a bug exists if the tableView's separatorStyle is changed while
    information it is in any non-loaded state
        - do other side effects also exist for UITableViewDataSource?