Or: Building Icebergs
I’ve started to work on modernizing my current large project at work for iOS 8. I had some minor tweaks to make to UI elements to fix rendering issues, mostly due to automatic table view heights, and I’m eager to remove certain chunks of old code.
So far my favorite, by a wide margin, is the
UIAlertController replacing UIAlertView. Between migrating to block based syntax, better handling of complex layouts, and not having every single button call back to delegate methods I’m very happy with the new control.
I also, perhaps foolishly, decided that as the project is getting to be rather massive, now would be a good time to separate it into frameworks.
In retrospect, a good time to separate it into frameworks would have been as I built the project. I’d been doing a decent job of segmenting the code, but I had to fiddle with it to reduce the number of dependencies and layers of dependencies in the code.
The enforced separation, after the fun that was figuring out just how to split up the code, has lead to several sections of the app that are now much cleaner. The product selection UI is now most of the way to being truly reusable, and behaves as a discrete UI that takes blocks for how to react to product selection and quantity changes, and only has 3 public methods. That replaced an old version that required interacting with two classes, implementing delegate protocols.
The other big benefit to that level of separation is I now have a better idea of how safe it is to monkey around with how classes work. Private classes in a framework are totally safe, public classes I now have a list of where each framework is used and have a goal for what to test next.