Skip to content

Instantly share code, notes, and snippets.

@RajaveluC
Last active December 21, 2015 10:49
Show Gist options
  • Save RajaveluC/6294366 to your computer and use it in GitHub Desktop.
Save RajaveluC/6294366 to your computer and use it in GitHub Desktop.
These set of files are intended to demonstrate a typical MVC architecture and how data flows between the different layers. Code snippet for ViewController Class goes here.
//
// ProfileViewController.h
// Project A
//
// Created by Company A on 7/27/13.
// Copyright (c) 2013 Company A. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "UserProfileService.h"
@interface ProfileViewController : ViewController <UserProfileServiceDelegate>
{
UserProfileService *profileService;
}
@end
//
// ProfileViewController.m
// Project A
//
// Created by Compnany A on 7/27/13.
// Copyright (c) 2013 Company A. All rights reserved.
//
#import "ProfileViewController.h"
@interface ProfileViewController ()
@end
@implementation ProfileViewController
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view from its nib.
profileService = [[UserProfileService alloc] init];
profileService.delegate=self;
// getting the profile with userId = 10
[profileService getProfileForId:10];
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
#pragma mark - Webservice delegates
-(void)didReceiveGetProfileResponseWithCode:(UserProfile*)profile error:(NSString *)error
{
// update the UI with the retreived user profile information
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment