implement static method

NSTextStorageDelegate implement({
  1. void textStorage_willProcessEditing_range_changeInLength_(
    1. NSTextStorage,
    2. NSTextStorageEditActions,
    3. NSRange,
    4. DartNSInteger,
    )?,
  2. void textStorage_didProcessEditing_range_changeInLength_(
    1. NSTextStorage,
    2. NSTextStorageEditActions,
    3. NSRange,
    4. DartNSInteger,
    )?,
  3. bool $keepIsolateAlive = true,
})

Builds an object that implements the NSTextStorageDelegate protocol. To implement multiple protocols, use addToBuilder or objc.ObjCProtocolBuilder directly.

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

Implementation

static NSTextStorageDelegate implement({
  void Function(
    NSTextStorage,
    NSTextStorageEditActions,
    NSRange,
    DartNSInteger,
  )?
  textStorage_willProcessEditing_range_changeInLength_,
  void Function(
    NSTextStorage,
    NSTextStorageEditActions,
    NSRange,
    DartNSInteger,
  )?
  textStorage_didProcessEditing_range_changeInLength_,
  bool $keepIsolateAlive = true,
}) {
  final builder = objc.ObjCProtocolBuilder(
    debugName: 'NSTextStorageDelegate',
  );
  NSTextStorageDelegate.textStorage_willProcessEditing_range_changeInLength_
      .implement(
        builder,
        textStorage_willProcessEditing_range_changeInLength_,
      );
  NSTextStorageDelegate.textStorage_didProcessEditing_range_changeInLength_
      .implement(
        builder,
        textStorage_didProcessEditing_range_changeInLength_,
      );
  builder.addProtocol($protocol);
  return NSTextStorageDelegate.castFrom(
    builder.build(keepIsolateAlive: $keepIsolateAlive),
  );
}