Enums as configuration: the anti-pattern
Implementing the open/closed principle 31 July 2016
One of the most common patterns I see in software design with Objective-C (and sometimes Swift), is the use of enumeration types (
enum) as configurations for a class. For example, passing an
enum to a
UIView to style it in a certain way. In this article, I explain why I think this is an anti-pattern and provide a more robust, modular, and extensible approach to solving this problem.