Your SlideShare is downloading. ×
iOS View Coordinators
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×

Saving this for later?

Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime - even offline.

Text the download link to your phone

Standard text messaging rates apply

iOS View Coordinators

2,960
views

Published on

Slides from a talk about reducing the complexity in UIViewController classes for iOS using a pattern of smaller view coordinators

Slides from a talk about reducing the complexity in UIViewController classes for iOS using a pattern of smaller view coordinators

Published in: Technology, Business

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
2,960
On Slideshare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
18
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide
  • \n
  • \n
  • \n
  • - small classes\n- small methods\n- single responsibility\n- not much logic, just decoupling\n
  • - nav controller push/pop\n- low memory conditions (recycle the views)\n\n
  • - nav controller push/pop\n- low memory conditions (recycle the views)\n\n
  • \n
  • \n
  • \n
  • \n
  • - one UIViewController to rule them all (single responsibility?)\n- sub UIViewControllers: complicated lifecycle\n- custom UIView subclasses shouldn’t have delegate callbacks\n
  • - automatic layout in full width horizontal\n- independent sections of the screen\n
  • - simplified view controller\n- managed the creation of the view (holds it)\n- hides callbacks (can’t use UIView for that)\n
  • - same object lifecycle, for delegate callbacks\n- simpler view lifecycle\n- automatic layout using stacked view\n
  • - same object lifecycle, for delegate callbacks\n- simpler view lifecycle\n- automatic layout using stacked view\n
  • - same object lifecycle, for delegate callbacks\n- simpler view lifecycle\n- automatic layout using stacked view\n
  • - same object lifecycle, for delegate callbacks\n- simpler view lifecycle\n- automatic layout using stacked view\n
  • - same object lifecycle, for delegate callbacks\n- simpler view lifecycle\n- automatic layout using stacked view\n
  • - same object lifecycle, for delegate callbacks\n- simpler view lifecycle\n- automatic layout using stacked view\n
  • - same object lifecycle, for delegate callbacks\n- simpler view lifecycle\n- automatic layout using stacked view\n
  • - same object lifecycle, for delegate callbacks\n- simpler view lifecycle\n- automatic layout using stacked view\n
  • \n
  • \n
  • Transcript

    • 1. Avoiding oversized view controllers in iOS Stewart Gleadow Email: sgleadow@thoughtworks.com Twitter: @stewgleadow
    • 2. What makes a classeasy to maintain?
    • 3. UIViewUIViewController Model
    • 4. What makes acontroller easy to maintain?
    • 5. UIViewController- (id)init;- (void)loadView;- (void)viewDidLoad;- (void)viewWillAppear:(BOOL);- (void)viewDidAppear:(BOOL);- (void)viewWillDisappear:(BOOL);- (void)viewDidDisappear: (BOOL);- (void)viewDidUnload;- (void)dealloc;
    • 6. UIViewController- (id)init;- (void)loadView;- (void)viewDidLoad;- (void)viewWillAppear:(BOOL);- (void)viewDidAppear:(BOOL);- (void)viewWillDisappear:(BOOL);- (void)viewDidDisappear: (BOOL);- (void)viewDidUnload;- (void)dealloc;
    • 7. UIViewController- (id)init;- (void)loadView;- (void)viewDidLoad;- (void)viewWillAppear:(BOOL);- (void)viewDidAppear:(BOOL);- (void)viewWillDisappear:(BOOL);- (void)viewDidDisappear: (BOOL);- (void)viewDidUnload;- (void)dealloc;
    • 8. - (id)init;{ if ((self = [super init])) { // create data related objects } return self;}- (void)dealloc;{ // release any data related objects [super dealloc];}
    • 9. - (void)loadView;{ [super loadView]; // create all your views // assign delegates}- (void)viewDidUnload;{ // release any view related [super viewDidUnload];}
    • 10. @interface MatchViewController : UIViewController <UITableViewDelegate, UITableViewDataSource, UIScrollViewDelegate, TTModelDelegate, ...>
    • 11. Coordinated Views View One View Two View Three
    • 12. Coordinator- (id)init;- (UIView *)view;- (void)releaseView;- (void)dealloc;
    • 13. ViewController Coordinator- (id)init; - (id)init;- (void)loadView; - (UIView *)view;- (void)viewDidLoad; - (void)releaseView;- (void)viewWillAppear:(BOOL);- (void)viewDidAppear:(BOOL); - (void)dealloc;- (void)viewWillDisappear:(BOOL);- (void)viewDidDisappear: (BOOL);- (void)viewDidUnload;- (void)dealloc;
    • 14. ViewController Coordinator- (id)init; - (id)init;- (void)loadView; - (UIView *)view;- (void)viewDidLoad; - (void)releaseView;- (void)viewWillAppear:(BOOL);- (void)viewDidAppear:(BOOL); - (void)dealloc;- (void)viewWillDisappear:(BOOL);- (void)viewDidDisappear: (BOOL);- (void)viewDidUnload;- (void)dealloc;
    • 15. ViewController Coordinator- (id)init; - (id)init;- (void)loadView; - (UIView *)view;- (void)viewDidLoad; - (void)releaseView;- (void)viewWillAppear:(BOOL);- (void)viewDidAppear:(BOOL); - (void)dealloc;- (void)viewWillDisappear:(BOOL);- (void)viewDidDisappear: (BOOL);- (void)viewDidUnload;- (void)dealloc;
    • 16. Demo
    • 17. Stewart GleadowEmail:sgleadow@thoughtworks.comTwitter:@stewgleadow