implement static method

NSXPCProxyCreating implement({
  1. required ObjCObjectBase remoteObjectProxy(),
  2. required ObjCObjectBase remoteObjectProxyWithErrorHandler_(
    1. ObjCBlock<Void Function(NSError)>
    ),
  3. ObjCObjectBase synchronousRemoteObjectProxyWithErrorHandler_(
    1. ObjCBlock<Void Function(NSError)>
    )?,
  4. bool $keepIsolateAlive = true,
})

Builds an object that implements the NSXPCProxyCreating 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 NSXPCProxyCreating implement({
  required Dartinstancetype Function() remoteObjectProxy,
  required objc.ObjCObjectBase Function(
    objc.ObjCBlock<ffi.Void Function(objc.NSError)>,
  )
  remoteObjectProxyWithErrorHandler_,
  objc.ObjCObjectBase Function(
    objc.ObjCBlock<ffi.Void Function(objc.NSError)>,
  )?
  synchronousRemoteObjectProxyWithErrorHandler_,
  bool $keepIsolateAlive = true,
}) {
  final builder = objc.ObjCProtocolBuilder(debugName: 'NSXPCProxyCreating');
  NSXPCProxyCreating.remoteObjectProxy.implement(builder, remoteObjectProxy);
  NSXPCProxyCreating.remoteObjectProxyWithErrorHandler_.implement(
    builder,
    remoteObjectProxyWithErrorHandler_,
  );
  NSXPCProxyCreating.synchronousRemoteObjectProxyWithErrorHandler_.implement(
    builder,
    synchronousRemoteObjectProxyWithErrorHandler_,
  );
  builder.addProtocol($protocol);
  return NSXPCProxyCreating.castFrom(
    builder.build(keepIsolateAlive: $keepIsolateAlive),
  );
}