This example project shows an easy and dynamic way to fill a tableview with enums
-
When an enum becomes helpful to fill a table view?
1.- When you have a menu (settings, sidebar as examples), you can easily use enums to populate the tableview. If at some point, a new row needs to be added, one can just add a new case in the enum.
2.- You have a view that can be separated in rows (custom cells) like a profile view or login view
-
Advantages
1.- Easy implementation
2.- Easy maintenance
3.- Everything is clearly encapsulated
-
Disadvantage
1.- When interacting with custom cells, it becomes a little bit complicated (blocks needs to be added to comunicate whatever to the main view)