I need to slim down mine as well.

Read the book "Refactoring" by Martin Fowler.

I'm not real sure how to proceed with mine; it grew organically.
Michael David Crawford, Consulting Software Engineer
mdcrawf...@gmail.com
http://www.warplife.com/mdc/

   Available for Software Development in the Portland, Oregon Metropolitan
Area.


On Wed, Apr 1, 2015 at 5:59 AM, Juan Felipe Alvarez Saldarriaga
<nebi...@gmail.com> wrote:
> Hi,
>
> How you guys slim down your view controllers?, sometimes you end up 
> implementing a lot of protocols in your view controller, so there's a lot of 
> code inside the controller itself. Reading about how to slim down view 
> controllers in iOS I found that a common way is to move DataSources 
> (http://www.objc.io/issue-1/lighter-view-controllers.html) to other class, 
> but what about other delegates?, or if you create views by code?. First, I 
> think about move each delegate to a NSObject class, so I try this:
>
> self.locationManager.delegate = 
> [[FRRYPetDescriptionViewControllerLocationDelegate alloc] init];
>
> Then I ask in IRC and somebody suggest categories, so this is what I got so 
> far:
>
> // FRRYPetDescriptionViewController.h
> @interface FRRYPetDescriptionViewController : UIViewController
>
> @property (nonatomic) CLLocationManager *locationManager;
>
> @property (nonatomic) TPKeyboardAvoidingScrollView *scrollView;
> @property (nonatomic) UIView *contentView;
>
> @end
>
> // FRRYPetDescriptionViewController+Protocols.h
> @interface FRRYPetDescriptionViewController (Protocols) <UITextViewDelegate, 
> UIActionSheetDelegate, MFMailComposeViewControllerDelegate, 
> UIGestureRecognizerDelegate, MKMapViewDelegate, 
> UIViewControllerTransitioningDelegate, CLLocationManagerDelegate>
>
> @end
>
> // FRRYPetDescriptionViewController+UIAdditions.h
> @interface FRRYPetDescriptionViewController (UIAdditions)
>
> - (void)createScrollView;
> - (void)createContentView;
>
> @end
>
> // FRRYPetDescriptionViewController+Callbacks.h
> @interface FRRYPetDescriptionViewController (Callbacks)
>
> @end
>
> // FRRYPetDescriptionViewController+LocationAdditions.h
> @interface FRRYPetDescriptionViewController (LocationAdditions)
>
> @end
>
> This makes me think, what about "private" methods?, do I need to declare all 
> properties in the view controller header file?. What you guys think about 
> this approach or there's some common pattern to follow to not end with a fat 
> controller?.
>
> Thank you.
>
> --
> Juan Felipe Alvarez Saldarriaga
> http://juan.im
> Twitter: @nebiros
> Google Talk: nebi...@gmail.com
> Skype: jfasaldarriaga
>
>
> _______________________________________________
>
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/mdcrawford%40gmail.com
>
> This email sent to mdcrawf...@gmail.com

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to