addToBuilderAsBlocking static method

void addToBuilderAsBlocking(
  1. ObjCProtocolBuilder builder, {
  2. required bool beginContentAccess(),
  3. required void endContentAccess(),
  4. required void discardContentIfPossible(),
  5. required bool isContentDiscarded(),
  6. bool $keepIsolateAlive = true,
})

Adds the implementation of the NSDiscardableContent protocol to an existing objc.ObjCProtocolBuilder. All methods that can be implemented as blocking listeners will be.

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

Implementation

static void addToBuilderAsBlocking(
  objc.ObjCProtocolBuilder builder, {
  required bool Function() beginContentAccess,
  required void Function() endContentAccess,
  required void Function() discardContentIfPossible,
  required bool Function() isContentDiscarded,
  bool $keepIsolateAlive = true,
}) {
  NSDiscardableContent.beginContentAccess.implement(
    builder,
    beginContentAccess,
  );
  NSDiscardableContent.endContentAccess.implementAsBlocking(
    builder,
    endContentAccess,
  );
  NSDiscardableContent.discardContentIfPossible.implementAsBlocking(
    builder,
    discardContentIfPossible,
  );
  NSDiscardableContent.isContentDiscarded.implement(
    builder,
    isContentDiscarded,
  );
  builder.addProtocol($protocol);
}