title: How should I create model class to call API (Using MVC pattern)?
body: <p>Currently I am calling an API in <code>viewcontroller</code> itself but this is not good programming practice as per MVC.<br>
  Here is my code:</p>
  
  <pre><code>-(void)fetchData{
  
      NSMutableURLRequest *request = [[NSMutableURLRequest alloc] init];
      [request setURL:[NSURL URLWithString:@"https://dl.dropboxusercontent.com/s/2iodh4vg0eortkl/facts.json"]];
      [request setHTTPMethod:@"GET"];
      [request addValue:@"text/plain" forHTTPHeaderField:@"Content-Type"];
      [request addValue:@"text/plain" forHTTPHeaderField:@"Accept"];
  
      NSURLSession *session = [NSURLSession sessionWithConfiguration:[NSURLSessionConfiguration defaultSessionConfiguration]];
      [[session dataTaskWithRequest:request completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
          NSString *requestReply = [[NSString alloc] initWithData:data encoding:NSASCIIStringEncoding];
          NSData * responseData = [requestReply dataUsingEncoding:NSUTF8StringEncoding];
          if (responseData != nil) {
  
              NSDictionary *jsonDict = [NSJSONSerialization JSONObjectWithData:responseData options:kNilOptions error:&amp;error];
              NSLog(@"requestReply: %@", jsonDict);
              self.content = jsonDict[@"rows"];
              self.navigationTitle = jsonDict[@"title"];
  
  
              dispatch_async(dispatch_get_main_queue(), ^{
                  [self.tableView reloadData];
  
              });
  
              NSLog(@"result %@", self.content);
  
          }
  
      }] resume];
  
  
  }
  </code></pre>
  
  <p>Can you please suggest how should I arrange code/file to follow MVC  pattern?<br>
  If I create separate model class how should I manage existing code and how I transfer response to <code>viewcontroller</code>? </p>