objective c - iOS Refactoring/design: One view controller to manage different models/streams? -
i'm working on app have different types of "streams" (think twitter). in have - pretty big - view controller manages of this. stream consists of 2 main entities - user , post - in different formats. in view controller have nsstring
property determine kind of stream is. leads lot of this:
if ([self.posttype isequaltostring:@"stream"]) { // stuff } else if [self.posttype ... [...] [...]
i don't know if best solution design wise, , leads lot of coupling. thing avoid lot of duplication. there better/nicer way same thing?
typedef enum{ stream, --, -- }posttype;
better use this..
switch (_posttype) { case stream: //do want break; case --: break; case --: break; }
Comments
Post a Comment