SKYOperation

@interface SKYOperation : NSOperation

Undocumented

  • Undocumented

    Declaration

    Objective-C

    @property (readwrite, strong, nonatomic) SKYContainer *_Nonnull container;

    Swift

    var container: SKYContainer { get set }
  • Undocumented

    Declaration

    Objective-C

    @property (readwrite, strong, nonatomic) SKYRequest *_Nonnull request;

    Swift

    var request: SKYRequest { get set }
  • The maximum time to wait before the request is considered time out.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) NSTimeInterval timeoutInterval;

    Swift

    var timeoutInterval: TimeInterval { get set }
  • The request requires an access token.

    Declaration

    Objective-C

    @property (readonly, nonatomic) BOOL requiresAPIKey;

    Swift

    var requiresAPIKey: Bool { get }
  • The request requires an access token.

    Declaration

    Objective-C

    @property (readonly, nonatomic) BOOL requiresAccessToken;

    Swift

    var requiresAccessToken: Bool { get }
  • Undocumented

    Declaration

    Objective-C

    - (nonnull instancetype)initWithRequest:(nonnull SKYRequest *)request;

    Swift

    init(request: SKYRequest)
  • Prepares the operation before a request takes place. You should implement this method by creating a object and setting the object to the property.

    The default implementation of this method throws an exception.

    This method is only called by when the property is . You are not expected to call this method directly.

    Declaration

    Objective-C

    - (void)prepareForRequest;

    Swift

    func prepareForRequest()
  • Handles request error when operation completes.

    If an error has occurred when making the request or when processing the returned data, this method will be called to handle the error. Either this method or the -handleResponse: method will be called, but not both.

    The default implementation of this method does nothing. Subclass is expected to implement this method. You are not expected to call this method directly.

    Declaration

    Objective-C

    - (void)handleRequestError:(nonnull NSError *)error;

    Swift

    func handleRequestError(_ error: Error)
  • Handles the response data when operation completes.

    When no error occurred when making the request, this method will be called to handle the response data.

    The default implementation of this method parse the response and call -handleResponse:. If you override this method, -handleResponse: is not be called. You are not expected to call this method directly.

    Declaration

    Objective-C

    - (void)handleResponseWithData:(nonnull NSData *)data;

    Swift

    func handleResponse(with data: Data)
  • Handles the parsed response when operation completes.

    When no error occurred when making the request or when processing the returned data, this method will be called to handle the response. Either this method or the -handleRequestError: method will be called, but not both.

    The default implementation of this method does nothing. Subclass is expected to implement this method. You are not expected to call this method directly.

    Declaration

    Objective-C

    - (void)handleResponse:(nonnull SKYResponse *)response;

    Swift

    func handle(_ response: SKYResponse)
  • Create a with the specified and . calls this method to create a NSURLSessionTask.

    If you override this method, the task you created should call -handleRequestCompletionWithData:response:error:.

    This method is expected to be overriden by subclass of . You are not expected to call this method directly.

    Declaration

    Objective-C

    - (nonnull NSURLSessionTask *)
    makeURLSessionTaskWithSession:(nonnull NSURLSession *)session
                          request:(nonnull NSURLRequest *)request;

    Swift

    func makeURLSessionTask(with session: URLSession, request: URLRequest) -> URLSessionTask
  • Creates a with specified as the property of this class. calls this method to create a .

    If the request cannot be created, this method should return nil and the error should be supplied.

    This method is expected to be overriden by subclass of . You are not expected to call this method directly.

    Declaration

    Objective-C

    - (NSURLRequest *_Nullable)makeURLRequestWithError:
        (NSError *_Nullable *_Nullable)error;

    Swift

    func makeURLRequest() throws -> URLRequest
  • Undocumented

    Declaration

    Objective-C

    - (void)handleRequestCompletionWithData:(NSData *_Nullable)data
                                   response:(NSURLResponse *_Nullable)response
                                      error:(NSError *_Nullable)requestError;

    Swift

    func handleRequestCompletion(with data: Data?, response: URLResponse?, error requestError: Error?)
  • Undocumented

    Declaration

    Objective-C

    - (void)operationWillStart;

    Swift

    func operationWillStart()
  • Undocumented

    Declaration

    Objective-C

    + (nonnull Class)responseClass;

    Swift

    class func responseClass() -> AnyClass