I ran into an interesting issue the other day and I thought I would share some insight that I gained from another developer. I was building out this view controller with multiple cell types and those cell types would be repeated in a specific order that had optional headers depending on the user flow, and each of those cell sets had a specific header that I wanted to display in my application. After I went through the inital logic and build the `titleForHeaderInSection` out I noticed it was very hard to read and follow what excatly was going on in the function. After talking with a more senior iOS developer we came up with this solution and I am currently applying it to not just the `titleForHeaderInSection` but also to the `cellForRow`.

What we decided was that since these header values will always be in specific orders we should setup an enum for them in its own extension on the class. I created this small gist example:



https://gist.github.com/EricADockery/521e83ba819dc08228e4db221c035c13