addToBuilder static method

void addToBuilder(
  1. ObjCProtocolBuilder builder, {
  2. void URLSession_didBecomeInvalidWithError_(
    1. NSURLSession,
    2. NSError?
    )?,
  3. void URLSession_didReceiveChallenge_completionHandler_(
    1. NSURLSession,
    2. NSURLAuthenticationChallenge,
    3. ObjCBlock<Void Function(NSInteger, NSURLCredential?)>
    )?,
  4. void URLSessionDidFinishEventsForBackgroundURLSession_(
    1. NSURLSession
    )?,
  5. bool $keepIsolateAlive = true,
})

Adds the implementation of the NSURLSessionDelegate protocol to an existing objc.ObjCProtocolBuilder.

Note: You cannot call this method after you have called builder.build.

Implementation

static void addToBuilder(
  objc.ObjCProtocolBuilder builder, {
  void Function(NSURLSession, objc.NSError?)?
  URLSession_didBecomeInvalidWithError_,
  void Function(
    NSURLSession,
    NSURLAuthenticationChallenge,
    objc.ObjCBlock<ffi.Void Function(NSInteger, NSURLCredential?)>,
  )?
  URLSession_didReceiveChallenge_completionHandler_,
  void Function(NSURLSession)?
  URLSessionDidFinishEventsForBackgroundURLSession_,
  bool $keepIsolateAlive = true,
}) {
  NSURLSessionDelegate.URLSession_didBecomeInvalidWithError_.implement(
    builder,
    URLSession_didBecomeInvalidWithError_,
  );
  NSURLSessionDelegate
      .URLSession_didReceiveChallenge_completionHandler_.implement(
    builder,
    URLSession_didReceiveChallenge_completionHandler_,
  );
  NSURLSessionDelegate
      .URLSessionDidFinishEventsForBackgroundURLSession_.implement(
    builder,
    URLSessionDidFinishEventsForBackgroundURLSession_,
  );
  builder.addProtocol($protocol);
}