How do you keep Cocoa controllers from getting too big?
Posted
by zoul
on Stack Overflow
See other posts from Stack Overflow
or by zoul
Published on 2010-05-18T18:45:31Z
Indexed on
2010/05/18
18:50 UTC
Read the original article
Hit count: 180
Hello! Do you have some tricks or techniques to break Cocoa controller classes into smaller chunks? I find that whatever I do the controllers end up being one of the more complicated classes in my design. The basic stuff is simple, but once I have several pop-overs or action sheets running, things get uncomfortably complex. It's not that bad, but still I would like to refactor the code into several standalone chunks.
I thought about categories, but the code is not that independent (a lot of times it needs to tap into viewWillAppear, for example) and I find that I spend a long time fighting the compiler. I also thought about adding functionality in layers using inheritance, but that feels like a hack.
© Stack Overflow or respective owner