iOS View Coordinators
Upcoming SlideShare
Loading in...5
×
 

iOS View Coordinators

on

  • 3,332 views

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

Statistics

Views

Total Views
3,332
Views on SlideShare
2,266
Embed Views
1,066

Actions

Likes
0
Downloads
18
Comments
0

5 Embeds 1,066

http://www.stewgleadow.com 864
http://sgleadow.github.com 152
http://localhost:4000 35
http://localhost 14
http://translate.googleusercontent.com 1

Accessibility

Upload Details

Uploaded via as Apple Keynote

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment
  • \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

iOS View Coordinators iOS View Coordinators Presentation Transcript

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