implementAsBlocking static method

NSCloudSharingServiceDelegate implementAsBlocking({
  1. void sharingService_didCompleteForItems_error_(
    1. NSSharingService,
    2. NSArray,
    3. NSError?
    )?,
  2. NSCloudKitSharingServiceOptions optionsForSharingService_shareProvider_(
    1. NSSharingService,
    2. NSItemProvider
    )?,
  3. void sharingService_didSaveShare_(
    1. NSSharingService,
    2. CKShare
    )?,
  4. void sharingService_didStopSharing_(
    1. NSSharingService,
    2. CKShare
    )?,
  5. void sharingService_willShareItems_(
    1. NSSharingService,
    2. NSArray
    )?,
  6. void sharingService_didFailToShareItems_error_(
    1. NSSharingService,
    2. NSArray,
    3. NSError
    )?,
  7. void sharingService_didShareItems_(
    1. NSSharingService,
    2. NSArray
    )?,
  8. NSRect sharingService_sourceFrameOnScreenForShareItem_(
    1. NSSharingService,
    2. ObjCObjectBase
    )?,
  9. NSImage? sharingService_transitionImageForShareItem_contentRect_(
    1. NSSharingService,
    2. ObjCObjectBase,
    3. Pointer<NSRect>
    )?,
  10. NSWindow? sharingService_sourceWindowForShareItems_sharingContentScope_(
    1. NSSharingService,
    2. NSArray,
    3. Pointer<NSInteger>
    )?,
  11. NSView? anchoringViewForSharingService_showRelativeToRect_preferredEdge_(
    1. NSSharingService,
    2. Pointer<NSRect>,
    3. Pointer<NSUInteger>
    )?,
  12. bool $keepIsolateAlive = true,
})
override

Builds an object that implements the NSCloudSharingServiceDelegate protocol. To implement multiple protocols, use addToBuilder or objc.ObjCProtocolBuilder directly. All methods that can be implemented as blocking listeners will be.

If $keepIsolateAlive is true, this protocol will keep this isolate alive until it is garbage collected by both Dart and ObjC.

Implementation

static NSCloudSharingServiceDelegate implementAsBlocking({
  void Function(NSSharingService, objc.NSArray, objc.NSError?)?
  sharingService_didCompleteForItems_error_,
  NSCloudKitSharingServiceOptions Function(
    NSSharingService,
    objc.NSItemProvider,
  )?
  optionsForSharingService_shareProvider_,
  void Function(NSSharingService, CKShare)? sharingService_didSaveShare_,
  void Function(NSSharingService, CKShare)? sharingService_didStopSharing_,
  void Function(NSSharingService, objc.NSArray)?
  sharingService_willShareItems_,
  void Function(NSSharingService, objc.NSArray, objc.NSError)?
  sharingService_didFailToShareItems_error_,
  void Function(NSSharingService, objc.NSArray)?
  sharingService_didShareItems_,
  NSRect Function(NSSharingService, objc.ObjCObjectBase)?
  sharingService_sourceFrameOnScreenForShareItem_,
  NSImage? Function(
    NSSharingService,
    objc.ObjCObjectBase,
    ffi.Pointer<NSRect>,
  )?
  sharingService_transitionImageForShareItem_contentRect_,
  NSWindow? Function(NSSharingService, objc.NSArray, ffi.Pointer<NSInteger>)?
  sharingService_sourceWindowForShareItems_sharingContentScope_,
  NSView? Function(
    NSSharingService,
    ffi.Pointer<NSRect>,
    ffi.Pointer<NSUInteger>,
  )?
  anchoringViewForSharingService_showRelativeToRect_preferredEdge_,
  bool $keepIsolateAlive = true,
}) {
  final builder = objc.ObjCProtocolBuilder(
    debugName: 'NSCloudSharingServiceDelegate',
  );
  NSCloudSharingServiceDelegate.sharingService_didCompleteForItems_error_
      .implementAsBlocking(
        builder,
        sharingService_didCompleteForItems_error_,
      );
  NSCloudSharingServiceDelegate.optionsForSharingService_shareProvider_
      .implement(builder, optionsForSharingService_shareProvider_);
  NSCloudSharingServiceDelegate.sharingService_didSaveShare_
      .implementAsBlocking(builder, sharingService_didSaveShare_);
  NSCloudSharingServiceDelegate.sharingService_didStopSharing_
      .implementAsBlocking(builder, sharingService_didStopSharing_);
  NSCloudSharingServiceDelegate.sharingService_willShareItems_
      .implementAsBlocking(builder, sharingService_willShareItems_);
  NSCloudSharingServiceDelegate.sharingService_didFailToShareItems_error_
      .implementAsBlocking(
        builder,
        sharingService_didFailToShareItems_error_,
      );
  NSCloudSharingServiceDelegate.sharingService_didShareItems_
      .implementAsBlocking(builder, sharingService_didShareItems_);
  NSCloudSharingServiceDelegate
      .sharingService_sourceFrameOnScreenForShareItem_
      .implement(builder, sharingService_sourceFrameOnScreenForShareItem_);
  NSCloudSharingServiceDelegate
      .sharingService_transitionImageForShareItem_contentRect_
      .implement(
        builder,
        sharingService_transitionImageForShareItem_contentRect_,
      );
  NSCloudSharingServiceDelegate
      .sharingService_sourceWindowForShareItems_sharingContentScope_
      .implement(
        builder,
        sharingService_sourceWindowForShareItems_sharingContentScope_,
      );
  NSCloudSharingServiceDelegate
      .anchoringViewForSharingService_showRelativeToRect_preferredEdge_
      .implement(
        builder,
        anchoringViewForSharingService_showRelativeToRect_preferredEdge_,
      );
  builder.addProtocol($protocol);
  return NSCloudSharingServiceDelegate.castFrom(
    builder.build(keepIsolateAlive: $keepIsolateAlive),
  );
}