Skip to content

Latest commit

 

History

History
63 lines (48 loc) · 2.69 KB

custom-request.md

File metadata and controls

63 lines (48 loc) · 2.69 KB

Custom Request

Handle every single aspect of your request before sending it out

You can simply change the request by implementing the protocol ALTableViewLoadingDelegate.

Objective-C Swift

  func willLoadTableView(with request: URLRequest!) -> URLRequest! {
    let mutableRequest = ((request as NSURLRequest).mutableCopy() as? NSMutableURLRequest)!
    mutableRequest.url = URL(string:"https://api.abstractlayer.com/demo/complex/get_contacts_and_messages")
    return request
  }

- (NSURLRequest *)willLoadTableViewWithRequest:(NSURLRequest *)request {
  NSMutableURLRequest *theRequest = [request mutableCopy];
  theRequest.URL = [NSURL URLWithString:@"https://api.abstractlayer.com/demo/complex/get_contacts_and_messages"];
  return theRequest;
}

Set loadingDelegate to one of your objects, then implement any of those methods accordingly.

Objective-C Swift

tableView.loadingDelegate = self

self.tableView.loadingDelegate = self;

Where to go next?

Abstract Layer supports lots of features on the ALTableView, so make sure to check the rest out!

As for customizability, Abstract Layer has a dedicated section for it.