diff --git a/.github/workflows/ffigen.yml b/.github/workflows/ffigen.yml index d8823f09e..a453bcb71 100644 --- a/.github/workflows/ffigen.yml +++ b/.github/workflows/ffigen.yml @@ -34,17 +34,17 @@ jobs: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 - uses: subosito/flutter-action@e938fdf56512cc96ef2f93601a5a40bde3801046 with: - channel: 'stable' + channel: master - id: install name: Install dependencies - run: flutter pub get && flutter pub get --directory="example/shared_bindings" && flutter pub get --directory="../objective_c" + run: dart pub get && dart pub get --directory="example/shared_bindings" && dart pub get --directory="../objective_c" - name: Check formatting run: dart format --output=none --set-exit-if-changed . if: always() && steps.install.outcome == 'success' - name: Build test dylib and bindings run: dart test/setup.dart - name: Analyze code - run: flutter analyze --fatal-infos + run: dart analyze --fatal-infos test-linux: needs: analyze @@ -56,9 +56,9 @@ jobs: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 - uses: subosito/flutter-action@e938fdf56512cc96ef2f93601a5a40bde3801046 with: - channel: 'stable' + channel: master - name: Install dependencies - run: flutter pub get && flutter pub get --directory="../jni" + run: dart pub get && flutter pub get --directory="../jni" - name: Install libclang-14-dev run: sudo apt-get install libclang-14-dev - name: Build test dylib and bindings @@ -80,9 +80,9 @@ jobs: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 - uses: subosito/flutter-action@e938fdf56512cc96ef2f93601a5a40bde3801046 with: - channel: stable + channel: master - name: Install dependencies - run: flutter pub get && flutter pub get --directory="../objective_c" && flutter pub get --directory="../jni" + run: dart pub get && dart pub get --directory="../objective_c" && flutter pub get --directory="../jni" - name: Install clang-format uses: ConorMacBride/install-package@3e7ad059e07782ee54fa35f827df52aae0626f30 with: @@ -122,7 +122,7 @@ jobs: with: channel: master - name: Install dependencies - run: flutter pub get && flutter pub get --directory="../objective_c" && flutter pub get --directory="../jni" + run: dart pub get && dart pub get --directory="../objective_c" && flutter pub get --directory="../jni" - name: Install clang-format uses: ConorMacBride/install-package@3e7ad059e07782ee54fa35f827df52aae0626f30 with: @@ -142,13 +142,13 @@ jobs: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 - uses: subosito/flutter-action@e938fdf56512cc96ef2f93601a5a40bde3801046 with: - channel: 'stable' + channel: master - name: Install dependencies - run: flutter pub get && flutter pub get --directory="../objective_c" + run: dart pub get && dart pub get --directory="../objective_c" - name: Build test dylib and bindings - run: dart test/setup.dart --main-thread-dispatcher + run: dart test/setup.dart - name: Run Flutter tests - run: flutter test + run: dart test test-windows: needs: analyze @@ -160,9 +160,9 @@ jobs: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 - uses: subosito/flutter-action@e938fdf56512cc96ef2f93601a5a40bde3801046 with: - channel: 'stable' + channel: master - name: Install dependencies - run: flutter pub get && flutter pub get --directory="../jni" + run: dart pub get && flutter pub get --directory="../jni" - name: Build test dylib and bindings run: dart test/setup.dart - name: Run VM tests @@ -191,7 +191,7 @@ jobs: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 - uses: subosito/flutter-action@e938fdf56512cc96ef2f93601a5a40bde3801046 with: - channel: "master" + channel: master - name: Install dependencies run: flutter pub get - name: Build test dylib and bindings diff --git a/.github/workflows/ffigen_weekly.yml b/.github/workflows/ffigen_weekly.yml index d7726e6f7..12854b7e0 100644 --- a/.github/workflows/ffigen_weekly.yml +++ b/.github/workflows/ffigen_weekly.yml @@ -30,17 +30,17 @@ jobs: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 - uses: subosito/flutter-action@e938fdf56512cc96ef2f93601a5a40bde3801046 with: - channel: 'stable' + channel: master - name: Install dependencies - run: flutter pub get && flutter pub get --directory="../objective_c" && flutter pub get --directory="../jni" + run: dart pub get && dart pub get --directory="../objective_c" && flutter pub get --directory="../jni" - name: Install clang-format uses: ConorMacBride/install-package@3e7ad059e07782ee54fa35f827df52aae0626f30 with: brew: clang-format - name: Build test dylib and bindings - run: dart test/setup.dart --main-thread-dispatcher + run: dart test/setup.dart - name: Run VM tests - run: flutter test + run: dart test - name: Generate package:jni bindings run: dart run tool/generate_ffi_bindings.dart working-directory: pkgs/jni/ diff --git a/.github/workflows/objective_c.yaml b/.github/workflows/objective_c.yaml index cfdc211cc..68042798c 100644 --- a/.github/workflows/objective_c.yaml +++ b/.github/workflows/objective_c.yaml @@ -31,17 +31,17 @@ jobs: fail-fast: false steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 - - uses: subosito/flutter-action@e938fdf56512cc96ef2f93601a5a40bde3801046 + - uses: dart-lang/setup-dart@e51d8e571e22473a2ddebf0ef8a2123f0ab2c02c with: - channel: 'stable' + sdk: dev - id: install name: Install dependencies - run: flutter pub get + run: dart pub get - name: Check formatting run: dart format --output=none --set-exit-if-changed . if: always() && steps.install.outcome == 'success' - name: Analyze code - run: flutter analyze --fatal-infos + run: dart analyze --fatal-infos if: always() && steps.install.outcome == 'success' test-mac: @@ -52,14 +52,11 @@ jobs: working-directory: pkgs/objective_c/ steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 - - uses: subosito/flutter-action@e938fdf56512cc96ef2f93601a5a40bde3801046 + - uses: dart-lang/setup-dart@e51d8e571e22473a2ddebf0ef8a2123f0ab2c02c with: - channel: 'stable' + sdk: dev - name: Install dependencies - run: flutter pub get - - name: Build test dylib - # TODO(https://github.com/dart-lang/native/issues/1068): Remove this. - run: dart test/setup.dart + run: dart pub get - name: Install coverage run: dart pub global activate coverage - name: Run VM tests and collect coverage @@ -87,13 +84,13 @@ jobs: runs-on: 'macos-latest' defaults: run: - working-directory: pkgs/objective_c/example/ + working-directory: pkgs/objective_c/example steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 - - uses: subosito/flutter-action@e938fdf56512cc96ef2f93601a5a40bde3801046 + - uses: dart-lang/setup-dart@e51d8e571e22473a2ddebf0ef8a2123f0ab2c02c with: - channel: 'stable' + sdk: dev - name: Install dependencies - run: flutter pub get - - name: Build the example app - run: flutter build macos + run: dart pub get + - name: Run the example app + run: dart run lib/main.dart diff --git a/pkgs/ffigen/lib/src/code_generator/objc_block.dart b/pkgs/ffigen/lib/src/code_generator/objc_block.dart index 28ad1e321..30bf0b4b3 100644 --- a/pkgs/ffigen/lib/src/code_generator/objc_block.dart +++ b/pkgs/ffigen/lib/src/code_generator/objc_block.dart @@ -141,11 +141,20 @@ class ObjCBlock extends BindingType { final closureCallable = w.topLevelUniqueNamer.makeUnique( '_${name}_closureCallable', ); + final sharedTrampoline = w.topLevelUniqueNamer.makeUnique( + '_${name}_sharedTrampoline', + ); + final sharedCallable = w.topLevelUniqueNamer.makeUnique( + '_${name}_sharedCallable', + ); final listenerTrampoline = w.topLevelUniqueNamer.makeUnique( '_${name}_listenerTrampoline', ); - final listenerCallable = w.topLevelUniqueNamer.makeUnique( - '_${name}_listenerCallable', + final listenerPort = w.topLevelUniqueNamer.makeUnique( + '_${name}_listenerPort', + ); + final listenerSendPort = w.topLevelUniqueNamer.makeUnique( + '_${name}_listenerSendPort', ); final blockingTrampoline = w.topLevelUniqueNamer.makeUnique( '_${name}_blockingTrampoline', @@ -163,6 +172,7 @@ class ObjCBlock extends BindingType { final newPointerBlock = ObjCBuiltInFunctions.newPointerBlock.gen(w); final newClosureBlock = ObjCBuiltInFunctions.newClosureBlock.gen(w); final getBlockClosure = ObjCBuiltInFunctions.getBlockClosure.gen(w); + final retainFn = ObjCBuiltInFunctions.objectRetain.gen(w); final releaseFn = ObjCBuiltInFunctions.objectRelease.gen(w); final objCContext = ObjCBuiltInFunctions.objCContext.gen(w); final signalWaiterFn = ObjCBuiltInFunctions.signalWaiter.gen(w); @@ -194,14 +204,30 @@ $voidPtrCType $closureCallable = ${w.ffiLibraryPrefix}.Pointer.fromFunction< if (hasListener) { // Write the listener trampoline function. + final retains = ['$retainFn(block.cast()).cast()']; + for (var i = 0; i < params.length; ++i) { + final param = params[i]; + final argName = 'arg$i'; + retains.add(param.type.generateDartRetain(w, argName) ?? argName); + } s.write(''' -$returnFfiDartType $listenerTrampoline( +$returnFfiDartType $sharedTrampoline( $blockCType block, ${func.paramsFfiDartType}) { + final msg = (${retains.join(', ')}); + $listenerSendPort.send(msg); +} +${func.trampNatCallType} $sharedCallable = + ${func.trampNatCallType}.isolateGroupShared( + $sharedTrampoline $exceptionalReturn)..keepIsolateAlive = false; +$returnFfiDartType $listenerTrampoline(dynamic msg) { + final ${params.isEmpty ? '$blockCType block' : '($blockCType block, ${func.paramsFfiDartType})'} = msg; ($getBlockClosure(block) as ${func.ffiDartType})(${func.paramsNameOnly}); $releaseFn(block.cast()); } -${func.trampNatCallType} $listenerCallable = ${func.trampNatCallType}.listener( - $listenerTrampoline $exceptionalReturn)..keepIsolateAlive = false; +final $listenerPort = RawReceivePort( + $listenerTrampoline)..keepIsolateAlive = false; +@pragma('vm:shared') +final $listenerSendPort = $listenerPort.sendPort; $returnFfiDartType $blockingTrampoline( $blockCType block, ${blockingFunc.paramsFfiDartType}) { try { @@ -295,7 +321,6 @@ abstract final class $name { ); final listenerConvFn = '(${func.paramsFfiDartType}) => $listenerConvFnInvocation'; - final wrapListenerFn = _blockWrappers!.listenerWrapper.name; final wrapBlockingFn = _blockWrappers!.blockingWrapper.name; s.write(''' @@ -311,11 +336,10 @@ abstract final class $name { /// until it is garbage collected by both Dart and ObjC. static $blockType listener(${func.dartType} fn, {bool keepIsolateAlive = true}) { - final raw = $newClosureBlock($listenerCallable.nativeFunction.cast(), + final tramp = $newClosureBlock($sharedCallable.nativeFunction.cast(), $listenerConvFn, keepIsolateAlive); - final wrapper = $wrapListenerFn(raw); - $releaseFn(raw.cast()); - return $blockType(wrapper, retain: false, release: true); + print('listener send port: ' + $listenerSendPort.toString()); + return $blockType(tramp, retain: true, release: true); } /// Creates a blocking block from a Dart function. @@ -419,7 +443,6 @@ ref.pointer.ref.invoke.cast<${func.trampNatFnCType}>() ...argsReceived, ].join(', '); - final listenerWrapper = _blockWrappers!.listenerWrapper.name; final blockingWrapper = _blockWrappers!.blockingWrapper.name; final listenerName = UniqueNamer.cSafeName( w.objCLevelUniqueNamer.makeUnique('ListenerTrampoline'), @@ -431,14 +454,6 @@ ref.pointer.ref.invoke.cast<${func.trampNatFnCType}>() return ''' typedef ${returnType.getNativeType()} (^$listenerName)($argStr); -__attribute__((visibility("default"))) __attribute__((used)) -$listenerName $listenerWrapper($listenerName block) NS_RETURNS_RETAINED { - return ^void($argStr) { - ${generateRetain('block')}; - block(${retains.join(', ')}); - }; -} - typedef ${returnType.getNativeType()} (^$blockingName)($blockingArgStr); __attribute__((visibility("default"))) __attribute__((used)) $listenerName $blockingWrapper( @@ -532,6 +547,10 @@ $ret $fnName(id target, $argRecv) { @override String? generateRetain(String value) => 'objc_retainBlock($value)'; + @override + String? generateDartRetain(Writer w, String value) => + '${ObjCBuiltInFunctions.blockRetain.gen(w)}($value.cast()).cast()'; + @override String toString() => '($returnType (^)(${params.map((p) => p.type.toString()).join(', ')}))'; diff --git a/pkgs/ffigen/lib/src/code_generator/objc_built_in_functions.dart b/pkgs/ffigen/lib/src/code_generator/objc_built_in_functions.dart index 9df82aff0..84c5decdd 100644 --- a/pkgs/ffigen/lib/src/code_generator/objc_built_in_functions.dart +++ b/pkgs/ffigen/lib/src/code_generator/objc_built_in_functions.dart @@ -32,6 +32,8 @@ class ObjCBuiltInFunctions { 'getProtocolMethodSignature', ); static const getProtocol = ObjCImport('getProtocol'); + static const blockRetain = ObjCImport('blockRetain'); + static const objectRetain = ObjCImport('objectRetain'); static const objectRelease = ObjCImport('objectRelease'); static const signalWaiter = ObjCImport('signalWaiter'); static const objCContext = ObjCImport('objCContext'); diff --git a/pkgs/ffigen/lib/src/code_generator/objc_built_in_types.dart b/pkgs/ffigen/lib/src/code_generator/objc_built_in_types.dart index a150eb96e..78fcc2f63 100644 --- a/pkgs/ffigen/lib/src/code_generator/objc_built_in_types.dart +++ b/pkgs/ffigen/lib/src/code_generator/objc_built_in_types.dart @@ -131,12 +131,3 @@ const objCBuiltInCategories = { 'NSNumberIsFloat', 'NSStringExtensionMethods', }; - -const objCBuiltInGlobals = { - 'NSKeyValueChangeIndexesKey', - 'NSKeyValueChangeKindKey', - 'NSKeyValueChangeNewKey', - 'NSKeyValueChangeNotificationIsPriorKey', - 'NSKeyValueChangeOldKey', - 'NSLocalizedDescriptionKey', -}; diff --git a/pkgs/ffigen/lib/src/code_generator/objc_interface.dart b/pkgs/ffigen/lib/src/code_generator/objc_interface.dart index f2210e6a6..e6e997f59 100644 --- a/pkgs/ffigen/lib/src/code_generator/objc_interface.dart +++ b/pkgs/ffigen/lib/src/code_generator/objc_interface.dart @@ -214,6 +214,10 @@ ${generateAsStub ? '' : _generateMethods(w)} String? generateRetain(String value) => '(__bridge id)(__bridge_retained void*)($value)'; + @override + String? generateDartRetain(Writer w, String value) => + '${ObjCBuiltInFunctions.objectRetain.gen(w)}($value)'; + @override void visit(Visitation visitation) => visitation.visitObjCInterface(this); diff --git a/pkgs/ffigen/lib/src/code_generator/objc_nullable.dart b/pkgs/ffigen/lib/src/code_generator/objc_nullable.dart index 716536ea9..fb0a15f1d 100644 --- a/pkgs/ffigen/lib/src/code_generator/objc_nullable.dart +++ b/pkgs/ffigen/lib/src/code_generator/objc_nullable.dart @@ -94,6 +94,10 @@ class ObjCNullable extends Type { @override String? generateRetain(String value) => child.generateRetain(value); + @override + String? generateDartRetain(Writer w, String value) => + child.generateDartRetain(w, value); + @override String toString() => '$child?'; diff --git a/pkgs/ffigen/lib/src/code_generator/objc_protocol.dart b/pkgs/ffigen/lib/src/code_generator/objc_protocol.dart index 9de3dae4a..d4d3a3a13 100644 --- a/pkgs/ffigen/lib/src/code_generator/objc_protocol.dart +++ b/pkgs/ffigen/lib/src/code_generator/objc_protocol.dart @@ -352,6 +352,10 @@ Protocol* _${wrapName}_$originalName(void) { return @protocol($originalName); } String? generateRetain(String value) => '(__bridge id)(__bridge_retained void*)($value)'; + @override + String? generateDartRetain(Writer w, String value) => + '${ObjCBuiltInFunctions.objectRetain.gen(w)}($value)'; + bool _isSuperProtocolOf(ObjCProtocol protocol) { if (protocol == this) return true; for (final superProtocol in protocol.superProtocols) { diff --git a/pkgs/ffigen/lib/src/code_generator/pointer.dart b/pkgs/ffigen/lib/src/code_generator/pointer.dart index b404eaacb..be71fb8e9 100644 --- a/pkgs/ffigen/lib/src/code_generator/pointer.dart +++ b/pkgs/ffigen/lib/src/code_generator/pointer.dart @@ -154,6 +154,10 @@ class ObjCObjectPointer extends PointerType { String? generateRetain(String value) => '(__bridge id)(__bridge_retained void*)($value)'; + @override + String? generateDartRetain(Writer w, String value) => + '${ObjCBuiltInFunctions.objectRetain.gen(w)}($value)'; + @override bool isSupertypeOf(Type other) { other = other.typealiasType; @@ -177,6 +181,10 @@ class ObjCBlockPointer extends ObjCObjectPointer { @override String? generateRetain(String value) => 'objc_retainBlock($value)'; + @override + String? generateDartRetain(Writer w, String value) => + '${ObjCBuiltInFunctions.blockRetain.gen(w)}($value.cast()).cast()'; + @override bool isSupertypeOf(Type other) { other = other.typealiasType; diff --git a/pkgs/ffigen/lib/src/code_generator/type.dart b/pkgs/ffigen/lib/src/code_generator/type.dart index 71c929755..e495767cf 100644 --- a/pkgs/ffigen/lib/src/code_generator/type.dart +++ b/pkgs/ffigen/lib/src/code_generator/type.dart @@ -114,6 +114,10 @@ abstract class Type extends AstNode { /// Returns null if the Type does not need to be retained. String? generateRetain(String value) => null; + /// Returns generated Dart code that retains a reference to the given value. + /// Returns null if the Type does not need to be retained. + String? generateDartRetain(Writer w, String value) => null; + /// Returns a human readable string representation of the Type. This is mostly /// just for debugging, but it may also be used for non-functional code (eg to /// name a variable or type in generated code). @@ -230,6 +234,9 @@ abstract class BindingType extends NoLookUpBinding implements Type { @override String? generateRetain(String value) => null; + @override + String? generateDartRetain(Writer w, String value) => null; + @override String toString() => originalName; diff --git a/pkgs/ffigen/lib/src/code_generator/typealias.dart b/pkgs/ffigen/lib/src/code_generator/typealias.dart index 1c5e70c79..021d47d1b 100644 --- a/pkgs/ffigen/lib/src/code_generator/typealias.dart +++ b/pkgs/ffigen/lib/src/code_generator/typealias.dart @@ -195,6 +195,10 @@ class Typealias extends BindingType { @override String? generateRetain(String value) => type.generateRetain(value); + @override + String? generateDartRetain(Writer w, String value) => + type.generateDartRetain(w, value); + @override String cacheKey() => type.cacheKey(); diff --git a/pkgs/ffigen/lib/src/code_generator/writer.dart b/pkgs/ffigen/lib/src/code_generator/writer.dart index 3284e7b79..af955eb7c 100644 --- a/pkgs/ffigen/lib/src/code_generator/writer.dart +++ b/pkgs/ffigen/lib/src/code_generator/writer.dart @@ -165,6 +165,7 @@ class Writer { ], ); } + additionalImports.forEach(markImportUsed); /// [_lookupFuncIdentifier] should be unique in top level. _lookupFuncIdentifier = _resolveNameConflict( @@ -258,6 +259,7 @@ class Writer { ..writeln("@$ffiLibraryPrefix.DefaultAsset('$nativeAssetId')") ..writeln('library;\n'); } + result.writeln("import 'dart:isolate';"); /// Write [lookUpBindings]. if (lookUpBindings.isNotEmpty) { diff --git a/pkgs/ffigen/pubspec.yaml b/pkgs/ffigen/pubspec.yaml index 193a1373b..d0cac1fdf 100644 --- a/pkgs/ffigen/pubspec.yaml +++ b/pkgs/ffigen/pubspec.yaml @@ -31,6 +31,7 @@ dependencies: package_config: ^2.1.0 path: ^1.8.0 pub_semver: ^2.1.4 + objective_c: ^8.1.0 quiver: ^3.0.0 yaml: ^3.0.0 yaml_edit: ^2.0.3 @@ -40,12 +41,14 @@ dev_dependencies: dart_flutter_team_lints: ^2.0.0 json_schema: ^5.1.1 leak_tracker: ^10.0.7 - objective_c: ^8.1.0 - test: ^1.16.2 + test: ^1.26.2 dependency_overrides: - # package:objective_c has a flutter dependency, so `dart test` must be run - # using the dart from the flutter SDK. - # See https://github.com/dart-lang/native/issues/1068 + code_assets: + path: ../code_assets + hooks: + path: ../hooks + native_toolchain_c: + path: ../native_toolchain_c objective_c: - path: ../objective_c/ + path: ../objective_c diff --git a/pkgs/ffigen/test/native_objc_test/.gitignore b/pkgs/ffigen/test/native_objc_test/.gitignore index 24a8c4487..5929b07b3 100644 --- a/pkgs/ffigen/test/native_objc_test/.gitignore +++ b/pkgs/ffigen/test/native_objc_test/.gitignore @@ -2,4 +2,5 @@ *_bindings.m *_bindings.dart.m *-Swift.h +!block_bindings.* *.o diff --git a/pkgs/ffigen/test/native_objc_test/arc_test.dart b/pkgs/ffigen/test/native_objc_test/arc_test.dart index e23719c61..6b9a47bb9 100644 --- a/pkgs/ffigen/test/native_objc_test/arc_test.dart +++ b/pkgs/ffigen/test/native_objc_test/arc_test.dart @@ -22,16 +22,6 @@ void main() { group('ARC', () { setUpAll(() { - // TODO(https://github.com/dart-lang/native/issues/1068): Remove this. - DynamicLibrary.open( - path.join( - packagePathForTests, - '..', - 'objective_c', - 'test', - 'objective_c.dylib', - ), - ); final dylib = File( path.join( packagePathForTests, diff --git a/pkgs/ffigen/test/native_objc_test/bad_method_test.dart b/pkgs/ffigen/test/native_objc_test/bad_method_test.dart index 3f7d3f6db..23ad2a804 100644 --- a/pkgs/ffigen/test/native_objc_test/bad_method_test.dart +++ b/pkgs/ffigen/test/native_objc_test/bad_method_test.dart @@ -16,16 +16,6 @@ import 'util.dart'; void main() { group('bad_method_test', () { setUpAll(() { - // TODO(https://github.com/dart-lang/native/issues/1068): Remove this. - DynamicLibrary.open( - path.join( - packagePathForTests, - '..', - 'objective_c', - 'test', - 'objective_c.dylib', - ), - ); final dylib = File( path.join( packagePathForTests, diff --git a/pkgs/ffigen/test/native_objc_test/bad_override_test.dart b/pkgs/ffigen/test/native_objc_test/bad_override_test.dart index 761d3d240..df85a8fc5 100644 --- a/pkgs/ffigen/test/native_objc_test/bad_override_test.dart +++ b/pkgs/ffigen/test/native_objc_test/bad_override_test.dart @@ -18,16 +18,6 @@ import 'util.dart'; void main() { group('bad overrides', () { setUpAll(() { - // TODO(https://github.com/dart-lang/native/issues/1068): Remove this. - DynamicLibrary.open( - path.join( - packagePathForTests, - '..', - 'objective_c', - 'test', - 'objective_c.dylib', - ), - ); final dylib = File( path.join( packagePathForTests, diff --git a/pkgs/ffigen/test/native_objc_test/block_annotation_test.dart b/pkgs/ffigen/test/native_objc_test/block_annotation_test.dart index f716ddcc1..c864388c2 100644 --- a/pkgs/ffigen/test/native_objc_test/block_annotation_test.dart +++ b/pkgs/ffigen/test/native_objc_test/block_annotation_test.dart @@ -37,16 +37,6 @@ void main() { // correct block type. setUpAll(() { - // TODO(https://github.com/dart-lang/native/issues/1068): Remove this. - DynamicLibrary.open( - path.join( - packagePathForTests, - '..', - 'objective_c', - 'test', - 'objective_c.dylib', - ), - ); final dylib = File( path.join( packagePathForTests, diff --git a/pkgs/ffigen/test/native_objc_test/block_bindings.dart b/pkgs/ffigen/test/native_objc_test/block_bindings.dart new file mode 100644 index 000000000..c245d4bb4 --- /dev/null +++ b/pkgs/ffigen/test/native_objc_test/block_bindings.dart @@ -0,0 +1,5608 @@ +// ignore_for_file: camel_case_types, non_constant_identifier_names, unnecessary_non_null_assertion, unused_element, unused_field + +// AUTO GENERATED FILE, DO NOT EDIT. +// +// Generated by `package:ffigen`. +// ignore_for_file: type=lint +import 'dart:isolate'; +import 'dart:ffi' as ffi; +import 'package:objective_c/objective_c.dart' as objc; +import 'package:ffi/ffi.dart' as pkg_ffi; + +/// Tests calling Objective-C blocks. +class BlockTestObjCLibrary { + /// Holds the symbol lookup function. + final ffi.Pointer Function(String symbolName) + _lookup; + + /// The symbols are looked up in [dynamicLibrary]. + BlockTestObjCLibrary(ffi.DynamicLibrary dynamicLibrary) + : _lookup = dynamicLibrary.lookup; + + /// The symbols are looked up with [lookup]. + BlockTestObjCLibrary.fromLookup( + ffi.Pointer Function(String symbolName) lookup, + ) : _lookup = lookup; + + void objc_autoreleasePoolPop(ffi.Pointer pool) { + return _objc_autoreleasePoolPop(pool); + } + + late final _objc_autoreleasePoolPopPtr = + _lookup)>>( + 'objc_autoreleasePoolPop', + ); + late final _objc_autoreleasePoolPop = _objc_autoreleasePoolPopPtr + .asFunction)>(); + + ffi.Pointer objc_autoreleasePoolPush() { + return _objc_autoreleasePoolPush(); + } + + late final _objc_autoreleasePoolPushPtr = + _lookup Function()>>( + 'objc_autoreleasePoolPush', + ); + late final _objc_autoreleasePoolPush = _objc_autoreleasePoolPushPtr + .asFunction Function()>(); +} + +@ffi.Native< + ffi.Pointer Function(ffi.Pointer) +>(isLeaf: true) +external ffi.Pointer +_BlockTestObjCLibrary_wrapListenerBlock_1pl9qdv( + ffi.Pointer block, +); + +@ffi.Native< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ) +>(isLeaf: true) +external ffi.Pointer +_BlockTestObjCLibrary_wrapBlockingBlock_1pl9qdv( + ffi.Pointer block, + ffi.Pointer listnerBlock, + ffi.Pointer context, +); + +@ffi.Native< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ) +>() +external ffi.Pointer +_BlockTestObjCLibrary_protocolTrampoline_1mbt9g9( + ffi.Pointer target, + ffi.Pointer arg0, +); + +@ffi.Native< + ffi.Pointer Function(ffi.Pointer) +>(isLeaf: true) +external ffi.Pointer +_BlockTestObjCLibrary_wrapListenerBlock_1d9e4oe( + ffi.Pointer block, +); + +@ffi.Native< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ) +>(isLeaf: true) +external ffi.Pointer +_BlockTestObjCLibrary_wrapBlockingBlock_1d9e4oe( + ffi.Pointer block, + ffi.Pointer listnerBlock, + ffi.Pointer context, +); + +@ffi.Native< + ffi.Pointer Function(ffi.Pointer) +>(isLeaf: true) +external ffi.Pointer +_BlockTestObjCLibrary_wrapListenerBlock_f167m6( + ffi.Pointer block, +); + +@ffi.Native< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ) +>(isLeaf: true) +external ffi.Pointer +_BlockTestObjCLibrary_wrapBlockingBlock_f167m6( + ffi.Pointer block, + ffi.Pointer listnerBlock, + ffi.Pointer context, +); + +@ffi.Native< + ffi.Pointer Function(ffi.Pointer) +>(isLeaf: true) +external ffi.Pointer +_BlockTestObjCLibrary_wrapListenerBlock_xtuoz7( + ffi.Pointer block, +); + +@ffi.Native< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ) +>(isLeaf: true) +external ffi.Pointer +_BlockTestObjCLibrary_wrapBlockingBlock_xtuoz7( + ffi.Pointer block, + ffi.Pointer listnerBlock, + ffi.Pointer context, +); + +@ffi.Native< + ffi.Pointer Function(ffi.Pointer) +>(isLeaf: true) +external ffi.Pointer +_BlockTestObjCLibrary_wrapListenerBlock_ru30ue( + ffi.Pointer block, +); + +@ffi.Native< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ) +>(isLeaf: true) +external ffi.Pointer +_BlockTestObjCLibrary_wrapBlockingBlock_ru30ue( + ffi.Pointer block, + ffi.Pointer listnerBlock, + ffi.Pointer context, +); + +@ffi.Native< + ffi.Pointer Function(ffi.Pointer) +>(isLeaf: true) +external ffi.Pointer +_BlockTestObjCLibrary_wrapListenerBlock_li50va( + ffi.Pointer block, +); + +@ffi.Native< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ) +>(isLeaf: true) +external ffi.Pointer +_BlockTestObjCLibrary_wrapBlockingBlock_li50va( + ffi.Pointer block, + ffi.Pointer listnerBlock, + ffi.Pointer context, +); + +@ffi.Native< + ffi.Pointer Function(ffi.Pointer) +>(isLeaf: true) +external ffi.Pointer +_BlockTestObjCLibrary_wrapListenerBlock_yhkuco( + ffi.Pointer block, +); + +@ffi.Native< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ) +>(isLeaf: true) +external ffi.Pointer +_BlockTestObjCLibrary_wrapBlockingBlock_yhkuco( + ffi.Pointer block, + ffi.Pointer listnerBlock, + ffi.Pointer context, +); + +@ffi.Native< + ffi.Pointer Function(ffi.Pointer) +>(isLeaf: true) +external ffi.Pointer +_BlockTestObjCLibrary_wrapListenerBlock_1bqef4y( + ffi.Pointer block, +); + +@ffi.Native< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ) +>(isLeaf: true) +external ffi.Pointer +_BlockTestObjCLibrary_wrapBlockingBlock_1bqef4y( + ffi.Pointer block, + ffi.Pointer listnerBlock, + ffi.Pointer context, +); + +late final _class_NSThread = objc.getClass("NSThread"); +late final _sel_isKindOfClass_ = objc.registerName("isKindOfClass:"); +final _objc_msgSend_19nvye5 = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Bool Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ) + > + >() + .asFunction< + bool Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ) + >(); +late final _sel_currentThread = objc.registerName("currentThread"); +final _objc_msgSend_151sglz = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ) + > + >() + .asFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ) + >(); +void _ObjCBlock_ffiVoid_fnPtrTrampoline( + ffi.Pointer block, +) => block.ref.target + .cast>() + .asFunction()(); +ffi.Pointer _ObjCBlock_ffiVoid_fnPtrCallable = + ffi.Pointer.fromFunction< + ffi.Void Function(ffi.Pointer) + >(_ObjCBlock_ffiVoid_fnPtrTrampoline) + .cast(); +void _ObjCBlock_ffiVoid_closureTrampoline( + ffi.Pointer block, +) => (objc.getBlockClosure(block) as void Function())(); +ffi.Pointer _ObjCBlock_ffiVoid_closureCallable = + ffi.Pointer.fromFunction< + ffi.Void Function(ffi.Pointer) + >(_ObjCBlock_ffiVoid_closureTrampoline) + .cast(); +void _ObjCBlock_ffiVoid_sharedTrampoline( + ffi.Pointer block, +) { + final msg = (objc.objectRetain(block.cast()).cast()); + _ObjCBlock_ffiVoid_listenerSendPort.send(msg); +} + +ffi.NativeCallable)> +_ObjCBlock_ffiVoid_sharedCallable = + ffi.NativeCallable< + ffi.Void Function(ffi.Pointer) + >.isolateGroupShared(_ObjCBlock_ffiVoid_sharedTrampoline) + ..keepIsolateAlive = false; +void _ObjCBlock_ffiVoid_listenerTrampoline(dynamic msg) { + final ffi.Pointer block = msg; + (objc.getBlockClosure(block) as void Function())(); + objc.objectRelease(block.cast()); +} + +final _ObjCBlock_ffiVoid_listenerPort = RawReceivePort( + _ObjCBlock_ffiVoid_listenerTrampoline, +)..keepIsolateAlive = false; +@pragma('vm:shared') +final _ObjCBlock_ffiVoid_listenerSendPort = + _ObjCBlock_ffiVoid_listenerPort.sendPort; +void _ObjCBlock_ffiVoid_blockingTrampoline( + ffi.Pointer block, + ffi.Pointer waiter, +) { + try { + (objc.getBlockClosure(block) as void Function())(); + } catch (e) { + } finally { + objc.signalWaiter(waiter); + objc.objectRelease(block.cast()); + } +} + +ffi.NativeCallable< + ffi.Void Function(ffi.Pointer, ffi.Pointer) +> +_ObjCBlock_ffiVoid_blockingCallable = + ffi.NativeCallable< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ) + >.isolateLocal(_ObjCBlock_ffiVoid_blockingTrampoline) + ..keepIsolateAlive = false; +ffi.NativeCallable< + ffi.Void Function(ffi.Pointer, ffi.Pointer) +> +_ObjCBlock_ffiVoid_blockingListenerCallable = + ffi.NativeCallable< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ) + >.listener(_ObjCBlock_ffiVoid_blockingTrampoline) + ..keepIsolateAlive = false; + +/// Construction methods for `objc.ObjCBlock`. +abstract final class ObjCBlock_ffiVoid { + /// Returns a block that wraps the given raw block pointer. + static objc.ObjCBlock castFromPointer( + ffi.Pointer pointer, { + bool retain = false, + bool release = false, + }) => objc.ObjCBlock( + pointer, + retain: retain, + release: release, + ); + + /// Creates a block from a C function pointer. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock fromFunctionPointer( + ffi.Pointer> ptr, + ) => objc.ObjCBlock( + objc.newPointerBlock(_ObjCBlock_ffiVoid_fnPtrCallable, ptr.cast()), + retain: false, + release: true, + ); + + /// Creates a block from a Dart function. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + /// + /// If `keepIsolateAlive` is true, this block will keep this isolate alive + /// until it is garbage collected by both Dart and ObjC. + static objc.ObjCBlock fromFunction( + void Function() fn, { + bool keepIsolateAlive = true, + }) => objc.ObjCBlock( + objc.newClosureBlock( + _ObjCBlock_ffiVoid_closureCallable, + () => fn(), + keepIsolateAlive, + ), + retain: false, + release: true, + ); + + /// Creates a listener block from a Dart function. + /// + /// This is based on FFI's NativeCallable.listener, and has the same + /// capabilities and limitations. This block can be invoked from any thread, + /// but only supports void functions, and is not run synchronously. See + /// NativeCallable.listener for more details. + /// + /// If `keepIsolateAlive` is true, this block will keep this isolate alive + /// until it is garbage collected by both Dart and ObjC. + static objc.ObjCBlock listener( + void Function() fn, { + bool keepIsolateAlive = true, + }) { + final tramp = objc.newClosureBlock( + _ObjCBlock_ffiVoid_sharedCallable.nativeFunction.cast(), + () => fn(), + keepIsolateAlive, + ); + print( + 'listener send port: ' + _ObjCBlock_ffiVoid_listenerSendPort.toString(), + ); + return objc.ObjCBlock( + tramp, + retain: true, + release: true, + ); + } + + /// Creates a blocking block from a Dart function. + /// + /// This callback can be invoked from any native thread, and will block the + /// caller until the callback is handled by the Dart isolate that created + /// the block. Async functions are not supported. + /// + /// If `keepIsolateAlive` is true, this block will keep this isolate alive + /// until it is garbage collected by both Dart and ObjC. If the owner isolate + /// has shut down, and the block is invoked by native code, it may block + /// indefinitely, or have other undefined behavior. + static objc.ObjCBlock blocking( + void Function() fn, { + bool keepIsolateAlive = true, + }) { + final raw = objc.newClosureBlock( + _ObjCBlock_ffiVoid_blockingCallable.nativeFunction.cast(), + () => fn(), + keepIsolateAlive, + ); + final rawListener = objc.newClosureBlock( + _ObjCBlock_ffiVoid_blockingListenerCallable.nativeFunction.cast(), + () => fn(), + keepIsolateAlive, + ); + final wrapper = _BlockTestObjCLibrary_wrapBlockingBlock_1pl9qdv( + raw, + rawListener, + objc.objCContext, + ); + objc.objectRelease(raw.cast()); + objc.objectRelease(rawListener.cast()); + return objc.ObjCBlock( + wrapper, + retain: false, + release: true, + ); + } +} + +/// Call operator for `objc.ObjCBlock`. +extension ObjCBlock_ffiVoid_CallExtension + on objc.ObjCBlock { + void call() => + ref.pointer.ref.invoke + .cast< + ffi.NativeFunction< + ffi.Void Function(ffi.Pointer block) + > + >() + .asFunction)>()( + ref.pointer, + ); +} + +late final _sel_detachNewThreadWithBlock_ = objc.registerName( + "detachNewThreadWithBlock:", +); +final _objc_msgSend_f167m6 = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ) + > + >() + .asFunction< + void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ) + >(); +late final _sel_detachNewThreadSelector_toTarget_withObject_ = objc + .registerName("detachNewThreadSelector:toTarget:withObject:"); +final _objc_msgSend_lzbvjm = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ) + > + >() + .asFunction< + void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ) + >(); +late final _sel_isMultiThreaded = objc.registerName("isMultiThreaded"); +final _objc_msgSend_91o635 = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Bool Function( + ffi.Pointer, + ffi.Pointer, + ) + > + >() + .asFunction< + bool Function( + ffi.Pointer, + ffi.Pointer, + ) + >(); +late final _sel_threadDictionary = objc.registerName("threadDictionary"); +late final _sel_sleepUntilDate_ = objc.registerName("sleepUntilDate:"); +final _objc_msgSend_xtuoz7 = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ) + > + >() + .asFunction< + void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ) + >(); +late final _sel_sleepForTimeInterval_ = objc.registerName( + "sleepForTimeInterval:", +); +final _objc_msgSend_hwm8nu = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Double, + ) + > + >() + .asFunction< + void Function( + ffi.Pointer, + ffi.Pointer, + double, + ) + >(); +late final _sel_exit = objc.registerName("exit"); +final _objc_msgSend_1pl9qdv = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ) + > + >() + .asFunction< + void Function( + ffi.Pointer, + ffi.Pointer, + ) + >(); +late final _sel_threadPriority = objc.registerName("threadPriority"); +final _objc_msgSend_1ukqyt8 = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Double Function( + ffi.Pointer, + ffi.Pointer, + ) + > + >() + .asFunction< + double Function( + ffi.Pointer, + ffi.Pointer, + ) + >(); +final _objc_msgSend_1ukqyt8Fpret = objc.msgSendFpretPointer + .cast< + ffi.NativeFunction< + ffi.Double Function( + ffi.Pointer, + ffi.Pointer, + ) + > + >() + .asFunction< + double Function( + ffi.Pointer, + ffi.Pointer, + ) + >(); +late final _sel_setThreadPriority_ = objc.registerName("setThreadPriority:"); +final _objc_msgSend_18chyc = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Bool Function( + ffi.Pointer, + ffi.Pointer, + ffi.Double, + ) + > + >() + .asFunction< + bool Function( + ffi.Pointer, + ffi.Pointer, + double, + ) + >(); +late final _sel_qualityOfService = objc.registerName("qualityOfService"); +final _objc_msgSend_oi8iq9 = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Long Function( + ffi.Pointer, + ffi.Pointer, + ) + > + >() + .asFunction< + int Function(ffi.Pointer, ffi.Pointer) + >(); +late final _sel_setQualityOfService_ = objc.registerName( + "setQualityOfService:", +); +final _objc_msgSend_n2da1l = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Long, + ) + > + >() + .asFunction< + void Function( + ffi.Pointer, + ffi.Pointer, + int, + ) + >(); +late final _sel_callStackReturnAddresses = objc.registerName( + "callStackReturnAddresses", +); +late final _sel_callStackSymbols = objc.registerName("callStackSymbols"); +late final _sel_name = objc.registerName("name"); +late final _sel_setName_ = objc.registerName("setName:"); +late final _sel_stackSize = objc.registerName("stackSize"); +final _objc_msgSend_xw2lbc = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.UnsignedLong Function( + ffi.Pointer, + ffi.Pointer, + ) + > + >() + .asFunction< + int Function(ffi.Pointer, ffi.Pointer) + >(); +late final _sel_setStackSize_ = objc.registerName("setStackSize:"); +final _objc_msgSend_1i9r4xy = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.UnsignedLong, + ) + > + >() + .asFunction< + void Function( + ffi.Pointer, + ffi.Pointer, + int, + ) + >(); +late final _sel_isMainThread = objc.registerName("isMainThread"); +late final _sel_mainThread = objc.registerName("mainThread"); +typedef instancetype = ffi.Pointer; +typedef Dartinstancetype = objc.ObjCObjectBase; +late final _sel_init = objc.registerName("init"); +late final _sel_initWithTarget_selector_object_ = objc.registerName( + "initWithTarget:selector:object:", +); +final _objc_msgSend_1eldwyi = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ) + > + >() + .asFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ) + >(); +late final _sel_initWithBlock_ = objc.registerName("initWithBlock:"); +final _objc_msgSend_nnxkei = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ) + > + >() + .asFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ) + >(); +late final _sel_isExecuting = objc.registerName("isExecuting"); +late final _sel_isFinished = objc.registerName("isFinished"); +late final _sel_isCancelled = objc.registerName("isCancelled"); +late final _sel_cancel = objc.registerName("cancel"); +late final _sel_start = objc.registerName("start"); +late final _sel_main = objc.registerName("main"); +late final _sel_new = objc.registerName("new"); +late final _sel_allocWithZone_ = objc.registerName("allocWithZone:"); +final _objc_msgSend_1cwp428 = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ) + > + >() + .asFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ) + >(); +late final _sel_alloc = objc.registerName("alloc"); + +/// NSThread +class NSThread extends objc.NSObject { + NSThread._( + ffi.Pointer pointer, { + bool retain = false, + bool release = false, + }) : super.castFromPointer(pointer, retain: retain, release: release); + + /// Constructs a [NSThread] that points to the same underlying object as [other]. + NSThread.castFrom(objc.ObjCObjectBase other) + : this._(other.ref.pointer, retain: true, release: true); + + /// Constructs a [NSThread] that wraps the given raw object pointer. + NSThread.castFromPointer( + ffi.Pointer other, { + bool retain = false, + bool release = false, + }) : this._(other, retain: retain, release: release); + + /// Returns whether [obj] is an instance of [NSThread]. + static bool isInstance(objc.ObjCObjectBase obj) { + return _objc_msgSend_19nvye5( + obj.ref.pointer, + _sel_isKindOfClass_, + _class_NSThread, + ); + } + + /// currentThread + static NSThread getCurrentThread() { + final _ret = _objc_msgSend_151sglz(_class_NSThread, _sel_currentThread); + return NSThread.castFromPointer(_ret, retain: true, release: true); + } + + /// detachNewThreadWithBlock: + static void detachNewThreadWithBlock( + objc.ObjCBlock block, + ) { + objc.checkOsVersionInternal( + 'NSThread.detachNewThreadWithBlock:', + iOS: (false, (10, 0, 0)), + macOS: (false, (10, 12, 0)), + ); + _objc_msgSend_f167m6( + _class_NSThread, + _sel_detachNewThreadWithBlock_, + block.ref.pointer, + ); + } + + /// detachNewThreadSelector:toTarget:withObject: + static void detachNewThreadSelector( + ffi.Pointer selector, { + required objc.ObjCObjectBase toTarget, + objc.ObjCObjectBase? withObject, + }) { + _objc_msgSend_lzbvjm( + _class_NSThread, + _sel_detachNewThreadSelector_toTarget_withObject_, + selector, + toTarget.ref.pointer, + withObject?.ref.pointer ?? ffi.nullptr, + ); + } + + /// isMultiThreaded + static bool isMultiThreaded() { + return _objc_msgSend_91o635(_class_NSThread, _sel_isMultiThreaded); + } + + /// threadDictionary + objc.NSMutableDictionary get threadDictionary { + final _ret = _objc_msgSend_151sglz(this.ref.pointer, _sel_threadDictionary); + return objc.NSMutableDictionary.castFromPointer( + _ret, + retain: true, + release: true, + ); + } + + /// sleepUntilDate: + static void sleepUntilDate(objc.NSDate date) { + _objc_msgSend_xtuoz7( + _class_NSThread, + _sel_sleepUntilDate_, + date.ref.pointer, + ); + } + + /// sleepForTimeInterval: + static void sleepForTimeInterval(double ti) { + _objc_msgSend_hwm8nu(_class_NSThread, _sel_sleepForTimeInterval_, ti); + } + + /// exit + static void exit() { + _objc_msgSend_1pl9qdv(_class_NSThread, _sel_exit); + } + + /// threadPriority + static double threadPriority() { + return objc.useMsgSendVariants + ? _objc_msgSend_1ukqyt8Fpret(_class_NSThread, _sel_threadPriority) + : _objc_msgSend_1ukqyt8(_class_NSThread, _sel_threadPriority); + } + + /// setThreadPriority: + static bool setThreadPriority(double p) { + return _objc_msgSend_18chyc(_class_NSThread, _sel_setThreadPriority_, p); + } + + /// threadPriority + double get threadPriority$1 { + objc.checkOsVersionInternal( + 'NSThread.threadPriority', + iOS: (false, (4, 0, 0)), + macOS: (false, (10, 6, 0)), + ); + return objc.useMsgSendVariants + ? _objc_msgSend_1ukqyt8Fpret(this.ref.pointer, _sel_threadPriority) + : _objc_msgSend_1ukqyt8(this.ref.pointer, _sel_threadPriority); + } + + /// setThreadPriority: + set threadPriority$1(double value) { + objc.checkOsVersionInternal( + 'NSThread.setThreadPriority:', + iOS: (false, (4, 0, 0)), + macOS: (false, (10, 6, 0)), + ); + _objc_msgSend_hwm8nu(this.ref.pointer, _sel_setThreadPriority_, value); + } + + /// qualityOfService + objc.NSQualityOfService get qualityOfService { + objc.checkOsVersionInternal( + 'NSThread.qualityOfService', + iOS: (false, (8, 0, 0)), + macOS: (false, (10, 10, 0)), + ); + final _ret = _objc_msgSend_oi8iq9(this.ref.pointer, _sel_qualityOfService); + return objc.NSQualityOfService.fromValue(_ret); + } + + /// setQualityOfService: + set qualityOfService(objc.NSQualityOfService value) { + objc.checkOsVersionInternal( + 'NSThread.setQualityOfService:', + iOS: (false, (8, 0, 0)), + macOS: (false, (10, 10, 0)), + ); + _objc_msgSend_n2da1l( + this.ref.pointer, + _sel_setQualityOfService_, + value.value, + ); + } + + /// callStackReturnAddresses + static objc.NSArray getCallStackReturnAddresses() { + objc.checkOsVersionInternal( + 'NSThread.callStackReturnAddresses', + iOS: (false, (2, 0, 0)), + macOS: (false, (10, 5, 0)), + ); + final _ret = _objc_msgSend_151sglz( + _class_NSThread, + _sel_callStackReturnAddresses, + ); + return objc.NSArray.castFromPointer(_ret, retain: true, release: true); + } + + /// callStackSymbols + static objc.NSArray getCallStackSymbols() { + objc.checkOsVersionInternal( + 'NSThread.callStackSymbols', + iOS: (false, (4, 0, 0)), + macOS: (false, (10, 6, 0)), + ); + final _ret = _objc_msgSend_151sglz(_class_NSThread, _sel_callStackSymbols); + return objc.NSArray.castFromPointer(_ret, retain: true, release: true); + } + + /// name + objc.NSString? get name { + objc.checkOsVersionInternal( + 'NSThread.name', + iOS: (false, (2, 0, 0)), + macOS: (false, (10, 5, 0)), + ); + final _ret = _objc_msgSend_151sglz(this.ref.pointer, _sel_name); + return _ret.address == 0 + ? null + : objc.NSString.castFromPointer(_ret, retain: true, release: true); + } + + /// setName: + set name(objc.NSString? value) { + objc.checkOsVersionInternal( + 'NSThread.setName:', + iOS: (false, (2, 0, 0)), + macOS: (false, (10, 5, 0)), + ); + _objc_msgSend_xtuoz7( + this.ref.pointer, + _sel_setName_, + value?.ref.pointer ?? ffi.nullptr, + ); + } + + /// stackSize + int get stackSize { + objc.checkOsVersionInternal( + 'NSThread.stackSize', + iOS: (false, (2, 0, 0)), + macOS: (false, (10, 5, 0)), + ); + return _objc_msgSend_xw2lbc(this.ref.pointer, _sel_stackSize); + } + + /// setStackSize: + set stackSize(int value) { + objc.checkOsVersionInternal( + 'NSThread.setStackSize:', + iOS: (false, (2, 0, 0)), + macOS: (false, (10, 5, 0)), + ); + _objc_msgSend_1i9r4xy(this.ref.pointer, _sel_setStackSize_, value); + } + + /// isMainThread + bool get isMainThread { + objc.checkOsVersionInternal( + 'NSThread.isMainThread', + iOS: (false, (2, 0, 0)), + macOS: (false, (10, 5, 0)), + ); + return _objc_msgSend_91o635(this.ref.pointer, _sel_isMainThread); + } + + /// isMainThread + static bool getIsMainThread$1() { + objc.checkOsVersionInternal( + 'NSThread.isMainThread', + iOS: (false, (2, 0, 0)), + macOS: (false, (10, 5, 0)), + ); + return _objc_msgSend_91o635(_class_NSThread, _sel_isMainThread); + } + + /// mainThread + static NSThread getMainThread() { + objc.checkOsVersionInternal( + 'NSThread.mainThread', + iOS: (false, (2, 0, 0)), + macOS: (false, (10, 5, 0)), + ); + final _ret = _objc_msgSend_151sglz(_class_NSThread, _sel_mainThread); + return NSThread.castFromPointer(_ret, retain: true, release: true); + } + + /// init + NSThread init() { + objc.checkOsVersionInternal( + 'NSThread.init', + iOS: (false, (2, 0, 0)), + macOS: (false, (10, 0, 0)), + ); + final _ret = _objc_msgSend_151sglz( + this.ref.retainAndReturnPointer(), + _sel_init, + ); + return NSThread.castFromPointer(_ret, retain: false, release: true); + } + + /// initWithTarget:selector:object: + NSThread initWithTarget( + objc.ObjCObjectBase target, { + required ffi.Pointer selector, + objc.ObjCObjectBase? object, + }) { + objc.checkOsVersionInternal( + 'NSThread.initWithTarget:selector:object:', + iOS: (false, (2, 0, 0)), + macOS: (false, (10, 5, 0)), + ); + final _ret = _objc_msgSend_1eldwyi( + this.ref.retainAndReturnPointer(), + _sel_initWithTarget_selector_object_, + target.ref.pointer, + selector, + object?.ref.pointer ?? ffi.nullptr, + ); + return NSThread.castFromPointer(_ret, retain: false, release: true); + } + + /// initWithBlock: + NSThread initWithBlock(objc.ObjCBlock block) { + objc.checkOsVersionInternal( + 'NSThread.initWithBlock:', + iOS: (false, (10, 0, 0)), + macOS: (false, (10, 12, 0)), + ); + final _ret = _objc_msgSend_nnxkei( + this.ref.retainAndReturnPointer(), + _sel_initWithBlock_, + block.ref.pointer, + ); + return NSThread.castFromPointer(_ret, retain: false, release: true); + } + + /// isExecuting + bool get executing { + objc.checkOsVersionInternal( + 'NSThread.isExecuting', + iOS: (false, (2, 0, 0)), + macOS: (false, (10, 5, 0)), + ); + return _objc_msgSend_91o635(this.ref.pointer, _sel_isExecuting); + } + + /// isFinished + bool get finished { + objc.checkOsVersionInternal( + 'NSThread.isFinished', + iOS: (false, (2, 0, 0)), + macOS: (false, (10, 5, 0)), + ); + return _objc_msgSend_91o635(this.ref.pointer, _sel_isFinished); + } + + /// isCancelled + bool get cancelled { + objc.checkOsVersionInternal( + 'NSThread.isCancelled', + iOS: (false, (2, 0, 0)), + macOS: (false, (10, 5, 0)), + ); + return _objc_msgSend_91o635(this.ref.pointer, _sel_isCancelled); + } + + /// cancel + void cancel() { + objc.checkOsVersionInternal( + 'NSThread.cancel', + iOS: (false, (2, 0, 0)), + macOS: (false, (10, 5, 0)), + ); + _objc_msgSend_1pl9qdv(this.ref.pointer, _sel_cancel); + } + + /// start + void start() { + objc.checkOsVersionInternal( + 'NSThread.start', + iOS: (false, (2, 0, 0)), + macOS: (false, (10, 5, 0)), + ); + _objc_msgSend_1pl9qdv(this.ref.pointer, _sel_start); + } + + /// main + void main() { + objc.checkOsVersionInternal( + 'NSThread.main', + iOS: (false, (2, 0, 0)), + macOS: (false, (10, 5, 0)), + ); + _objc_msgSend_1pl9qdv(this.ref.pointer, _sel_main); + } + + /// new + static NSThread new$() { + final _ret = _objc_msgSend_151sglz(_class_NSThread, _sel_new); + return NSThread.castFromPointer(_ret, retain: false, release: true); + } + + /// allocWithZone: + static NSThread allocWithZone(ffi.Pointer zone) { + final _ret = _objc_msgSend_1cwp428( + _class_NSThread, + _sel_allocWithZone_, + zone, + ); + return NSThread.castFromPointer(_ret, retain: false, release: true); + } + + /// alloc + static NSThread alloc() { + final _ret = _objc_msgSend_151sglz(_class_NSThread, _sel_alloc); + return NSThread.castFromPointer(_ret, retain: false, release: true); + } + + /// Returns a new instance of NSThread constructed with the default `new` method. + factory NSThread() => new$(); +} + +final class Vec2 extends ffi.Struct { + @ffi.Double() + external double x; + + @ffi.Double() + external double y; +} + +final class Vec4 extends ffi.Struct { + @ffi.Double() + external double x; + + @ffi.Double() + external double y; + + @ffi.Double() + external double z; + + @ffi.Double() + external double w; +} + +late final _class_DummyObject = objc.getClass("DummyObject"); +late final _sel_newWithCounter_ = objc.registerName("newWithCounter:"); +final _objc_msgSend_129vhbw = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ) + > + >() + .asFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ) + >(); +late final _sel_initWithCounter_ = objc.registerName("initWithCounter:"); +late final _sel_setCounter_ = objc.registerName("setCounter:"); +final _objc_msgSend_yhkuco = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ) + > + >() + .asFunction< + void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ) + >(); +late final _sel_dealloc = objc.registerName("dealloc"); +late final _sel_self = objc.registerName("self"); +ffi.Pointer _ObjCBlock_objcObjCObject_ffiVoid_fnPtrTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, +) => block.ref.target + .cast< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer arg0) + > + >() + .asFunction< + ffi.Pointer Function(ffi.Pointer) + >()(arg0); +ffi.Pointer _ObjCBlock_objcObjCObject_ffiVoid_fnPtrCallable = + ffi.Pointer.fromFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ) + >(_ObjCBlock_objcObjCObject_ffiVoid_fnPtrTrampoline) + .cast(); +ffi.Pointer +_ObjCBlock_objcObjCObject_ffiVoid_closureTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, +) => + (objc.getBlockClosure(block) + as ffi.Pointer Function(ffi.Pointer))(arg0); +ffi.Pointer _ObjCBlock_objcObjCObject_ffiVoid_closureCallable = + ffi.Pointer.fromFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ) + >(_ObjCBlock_objcObjCObject_ffiVoid_closureTrampoline) + .cast(); + +/// Construction methods for `objc.ObjCBlock Function(ffi.Pointer)>`. +abstract final class ObjCBlock_objcObjCObject_ffiVoid { + /// Returns a block that wraps the given raw block pointer. + static objc.ObjCBlock< + ffi.Pointer Function(ffi.Pointer) + > + castFromPointer( + ffi.Pointer pointer, { + bool retain = false, + bool release = false, + }) => + objc.ObjCBlock< + ffi.Pointer Function(ffi.Pointer) + >(pointer, retain: retain, release: release); + + /// Creates a block from a C function pointer. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock< + ffi.Pointer Function(ffi.Pointer) + > + fromFunctionPointer( + ffi.Pointer< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer arg0) + > + > + ptr, + ) => + objc.ObjCBlock< + ffi.Pointer Function(ffi.Pointer) + >( + objc.newPointerBlock( + _ObjCBlock_objcObjCObject_ffiVoid_fnPtrCallable, + ptr.cast(), + ), + retain: false, + release: true, + ); + + /// Creates a block from a Dart function. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + /// + /// If `keepIsolateAlive` is true, this block will keep this isolate alive + /// until it is garbage collected by both Dart and ObjC. + static objc.ObjCBlock< + ffi.Pointer Function(ffi.Pointer) + > + fromFunction( + objc.ObjCObjectBase Function(ffi.Pointer) fn, { + bool keepIsolateAlive = true, + }) => + objc.ObjCBlock< + ffi.Pointer Function(ffi.Pointer) + >( + objc.newClosureBlock( + _ObjCBlock_objcObjCObject_ffiVoid_closureCallable, + (ffi.Pointer arg0) => fn(arg0).ref.retainAndAutorelease(), + keepIsolateAlive, + ), + retain: false, + release: true, + ); +} + +/// Call operator for `objc.ObjCBlock Function(ffi.Pointer)>`. +extension ObjCBlock_objcObjCObject_ffiVoid_CallExtension + on + objc.ObjCBlock< + ffi.Pointer Function(ffi.Pointer) + > { + objc.ObjCObjectBase call(ffi.Pointer arg0) => objc.ObjCObjectBase( + ref.pointer.ref.invoke + .cast< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer block, + ffi.Pointer arg0, + ) + > + >() + .asFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ) + >()(ref.pointer, arg0), + retain: true, + release: true, + ); +} + +late final _sel_retain = objc.registerName("retain"); +late final _sel_autorelease = objc.registerName("autorelease"); + +/// DummyObject +class DummyObject extends objc.NSObject { + DummyObject._( + ffi.Pointer pointer, { + bool retain = false, + bool release = false, + }) : super.castFromPointer(pointer, retain: retain, release: release); + + /// Constructs a [DummyObject] that points to the same underlying object as [other]. + DummyObject.castFrom(objc.ObjCObjectBase other) + : this._(other.ref.pointer, retain: true, release: true); + + /// Constructs a [DummyObject] that wraps the given raw object pointer. + DummyObject.castFromPointer( + ffi.Pointer other, { + bool retain = false, + bool release = false, + }) : this._(other, retain: retain, release: release); + + /// Returns whether [obj] is an instance of [DummyObject]. + static bool isInstance(objc.ObjCObjectBase obj) { + return _objc_msgSend_19nvye5( + obj.ref.pointer, + _sel_isKindOfClass_, + _class_DummyObject, + ); + } + + /// newWithCounter: + static DummyObject newWithCounter(ffi.Pointer _counter) { + final _ret = _objc_msgSend_129vhbw( + _class_DummyObject, + _sel_newWithCounter_, + _counter, + ); + return DummyObject.castFromPointer(_ret, retain: false, release: true); + } + + /// initWithCounter: + DummyObject initWithCounter(ffi.Pointer _counter) { + final _ret = _objc_msgSend_129vhbw( + this.ref.retainAndReturnPointer(), + _sel_initWithCounter_, + _counter, + ); + return DummyObject.castFromPointer(_ret, retain: false, release: true); + } + + /// setCounter: + void setCounter(ffi.Pointer _counter) { + _objc_msgSend_yhkuco(this.ref.pointer, _sel_setCounter_, _counter); + } + + /// dealloc + void dealloc() { + _objc_msgSend_1pl9qdv(this.ref.pointer, _sel_dealloc); + } + + /// init + DummyObject init() { + objc.checkOsVersionInternal( + 'DummyObject.init', + iOS: (false, (2, 0, 0)), + macOS: (false, (10, 0, 0)), + ); + final _ret = _objc_msgSend_151sglz( + this.ref.retainAndReturnPointer(), + _sel_init, + ); + return DummyObject.castFromPointer(_ret, retain: false, release: true); + } + + /// new + static DummyObject new$() { + final _ret = _objc_msgSend_151sglz(_class_DummyObject, _sel_new); + return DummyObject.castFromPointer(_ret, retain: false, release: true); + } + + /// allocWithZone: + static DummyObject allocWithZone(ffi.Pointer zone) { + final _ret = _objc_msgSend_1cwp428( + _class_DummyObject, + _sel_allocWithZone_, + zone, + ); + return DummyObject.castFromPointer(_ret, retain: false, release: true); + } + + /// alloc + static DummyObject alloc() { + final _ret = _objc_msgSend_151sglz(_class_DummyObject, _sel_alloc); + return DummyObject.castFromPointer(_ret, retain: false, release: true); + } + + /// self + DummyObject self$1() { + final _ret = _objc_msgSend_151sglz(this.ref.pointer, _sel_self); + return DummyObject.castFromPointer(_ret, retain: true, release: true); + } + + /// retain + DummyObject retain() { + final _ret = _objc_msgSend_151sglz(this.ref.pointer, _sel_retain); + return DummyObject.castFromPointer(_ret, retain: true, release: true); + } + + /// autorelease + DummyObject autorelease() { + final _ret = _objc_msgSend_151sglz(this.ref.pointer, _sel_autorelease); + return DummyObject.castFromPointer(_ret, retain: true, release: true); + } + + /// Returns a new instance of DummyObject constructed with the default `new` method. + factory DummyObject() => new$(); +} + +int _ObjCBlock_Int32_Int32_fnPtrTrampoline( + ffi.Pointer block, + int arg0, +) => block.ref.target + .cast>() + .asFunction()(arg0); +ffi.Pointer _ObjCBlock_Int32_Int32_fnPtrCallable = + ffi.Pointer.fromFunction< + ffi.Int32 Function(ffi.Pointer, ffi.Int32) + >(_ObjCBlock_Int32_Int32_fnPtrTrampoline, 0) + .cast(); +int _ObjCBlock_Int32_Int32_closureTrampoline( + ffi.Pointer block, + int arg0, +) => (objc.getBlockClosure(block) as int Function(int))(arg0); +ffi.Pointer _ObjCBlock_Int32_Int32_closureCallable = + ffi.Pointer.fromFunction< + ffi.Int32 Function(ffi.Pointer, ffi.Int32) + >(_ObjCBlock_Int32_Int32_closureTrampoline, 0) + .cast(); + +/// Construction methods for `objc.ObjCBlock`. +abstract final class ObjCBlock_Int32_Int32 { + /// Returns a block that wraps the given raw block pointer. + static objc.ObjCBlock castFromPointer( + ffi.Pointer pointer, { + bool retain = false, + bool release = false, + }) => objc.ObjCBlock( + pointer, + retain: retain, + release: release, + ); + + /// Creates a block from a C function pointer. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock fromFunctionPointer( + ffi.Pointer> ptr, + ) => objc.ObjCBlock( + objc.newPointerBlock(_ObjCBlock_Int32_Int32_fnPtrCallable, ptr.cast()), + retain: false, + release: true, + ); + + /// Creates a block from a Dart function. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + /// + /// If `keepIsolateAlive` is true, this block will keep this isolate alive + /// until it is garbage collected by both Dart and ObjC. + static objc.ObjCBlock fromFunction( + int Function(int) fn, { + bool keepIsolateAlive = true, + }) => objc.ObjCBlock( + objc.newClosureBlock( + _ObjCBlock_Int32_Int32_closureCallable, + (int arg0) => fn(arg0), + keepIsolateAlive, + ), + retain: false, + release: true, + ); +} + +/// Call operator for `objc.ObjCBlock`. +extension ObjCBlock_Int32_Int32_CallExtension + on objc.ObjCBlock { + int call(int arg0) => + ref.pointer.ref.invoke + .cast< + ffi.NativeFunction< + ffi.Int32 Function( + ffi.Pointer block, + ffi.Int32 arg0, + ) + > + >() + .asFunction, int)>()( + ref.pointer, + arg0, + ); +} + +typedef IntBlock = ffi.Pointer; +typedef DartIntBlock = objc.ObjCBlock; +double _ObjCBlock_ffiFloat_ffiFloat_fnPtrTrampoline( + ffi.Pointer block, + double arg0, +) => block.ref.target + .cast>() + .asFunction()(arg0); +ffi.Pointer _ObjCBlock_ffiFloat_ffiFloat_fnPtrCallable = + ffi.Pointer.fromFunction< + ffi.Float Function(ffi.Pointer, ffi.Float) + >(_ObjCBlock_ffiFloat_ffiFloat_fnPtrTrampoline, 0.0) + .cast(); +double _ObjCBlock_ffiFloat_ffiFloat_closureTrampoline( + ffi.Pointer block, + double arg0, +) => (objc.getBlockClosure(block) as double Function(double))(arg0); +ffi.Pointer _ObjCBlock_ffiFloat_ffiFloat_closureCallable = + ffi.Pointer.fromFunction< + ffi.Float Function(ffi.Pointer, ffi.Float) + >(_ObjCBlock_ffiFloat_ffiFloat_closureTrampoline, 0.0) + .cast(); + +/// Construction methods for `objc.ObjCBlock`. +abstract final class ObjCBlock_ffiFloat_ffiFloat { + /// Returns a block that wraps the given raw block pointer. + static objc.ObjCBlock castFromPointer( + ffi.Pointer pointer, { + bool retain = false, + bool release = false, + }) => objc.ObjCBlock( + pointer, + retain: retain, + release: release, + ); + + /// Creates a block from a C function pointer. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock fromFunctionPointer( + ffi.Pointer> ptr, + ) => objc.ObjCBlock( + objc.newPointerBlock( + _ObjCBlock_ffiFloat_ffiFloat_fnPtrCallable, + ptr.cast(), + ), + retain: false, + release: true, + ); + + /// Creates a block from a Dart function. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + /// + /// If `keepIsolateAlive` is true, this block will keep this isolate alive + /// until it is garbage collected by both Dart and ObjC. + static objc.ObjCBlock fromFunction( + double Function(double) fn, { + bool keepIsolateAlive = true, + }) => objc.ObjCBlock( + objc.newClosureBlock( + _ObjCBlock_ffiFloat_ffiFloat_closureCallable, + (double arg0) => fn(arg0), + keepIsolateAlive, + ), + retain: false, + release: true, + ); +} + +/// Call operator for `objc.ObjCBlock`. +extension ObjCBlock_ffiFloat_ffiFloat_CallExtension + on objc.ObjCBlock { + double call(double arg0) => ref.pointer.ref.invoke + .cast< + ffi.NativeFunction< + ffi.Float Function( + ffi.Pointer block, + ffi.Float arg0, + ) + > + >() + .asFunction< + double Function(ffi.Pointer, double) + >()(ref.pointer, arg0); +} + +typedef FloatBlock = ffi.Pointer; +typedef DartFloatBlock = objc.ObjCBlock; +double _ObjCBlock_ffiDouble_ffiDouble_fnPtrTrampoline( + ffi.Pointer block, + double arg0, +) => block.ref.target + .cast>() + .asFunction()(arg0); +ffi.Pointer _ObjCBlock_ffiDouble_ffiDouble_fnPtrCallable = + ffi.Pointer.fromFunction< + ffi.Double Function(ffi.Pointer, ffi.Double) + >(_ObjCBlock_ffiDouble_ffiDouble_fnPtrTrampoline, 0.0) + .cast(); +double _ObjCBlock_ffiDouble_ffiDouble_closureTrampoline( + ffi.Pointer block, + double arg0, +) => (objc.getBlockClosure(block) as double Function(double))(arg0); +ffi.Pointer _ObjCBlock_ffiDouble_ffiDouble_closureCallable = + ffi.Pointer.fromFunction< + ffi.Double Function(ffi.Pointer, ffi.Double) + >(_ObjCBlock_ffiDouble_ffiDouble_closureTrampoline, 0.0) + .cast(); + +/// Construction methods for `objc.ObjCBlock`. +abstract final class ObjCBlock_ffiDouble_ffiDouble { + /// Returns a block that wraps the given raw block pointer. + static objc.ObjCBlock castFromPointer( + ffi.Pointer pointer, { + bool retain = false, + bool release = false, + }) => objc.ObjCBlock( + pointer, + retain: retain, + release: release, + ); + + /// Creates a block from a C function pointer. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock fromFunctionPointer( + ffi.Pointer> ptr, + ) => objc.ObjCBlock( + objc.newPointerBlock( + _ObjCBlock_ffiDouble_ffiDouble_fnPtrCallable, + ptr.cast(), + ), + retain: false, + release: true, + ); + + /// Creates a block from a Dart function. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + /// + /// If `keepIsolateAlive` is true, this block will keep this isolate alive + /// until it is garbage collected by both Dart and ObjC. + static objc.ObjCBlock fromFunction( + double Function(double) fn, { + bool keepIsolateAlive = true, + }) => objc.ObjCBlock( + objc.newClosureBlock( + _ObjCBlock_ffiDouble_ffiDouble_closureCallable, + (double arg0) => fn(arg0), + keepIsolateAlive, + ), + retain: false, + release: true, + ); +} + +/// Call operator for `objc.ObjCBlock`. +extension ObjCBlock_ffiDouble_ffiDouble_CallExtension + on objc.ObjCBlock { + double call(double arg0) => ref.pointer.ref.invoke + .cast< + ffi.NativeFunction< + ffi.Double Function( + ffi.Pointer block, + ffi.Double arg0, + ) + > + >() + .asFunction< + double Function(ffi.Pointer, double) + >()(ref.pointer, arg0); +} + +typedef DoubleBlock = ffi.Pointer; +typedef DartDoubleBlock = objc.ObjCBlock; +Vec4 _ObjCBlock_Vec4_Vec4_fnPtrTrampoline( + ffi.Pointer block, + Vec4 arg0, +) => block.ref.target + .cast>() + .asFunction()(arg0); +ffi.Pointer _ObjCBlock_Vec4_Vec4_fnPtrCallable = + ffi.Pointer.fromFunction< + Vec4 Function(ffi.Pointer, Vec4) + >(_ObjCBlock_Vec4_Vec4_fnPtrTrampoline) + .cast(); +Vec4 _ObjCBlock_Vec4_Vec4_closureTrampoline( + ffi.Pointer block, + Vec4 arg0, +) => (objc.getBlockClosure(block) as Vec4 Function(Vec4))(arg0); +ffi.Pointer _ObjCBlock_Vec4_Vec4_closureCallable = + ffi.Pointer.fromFunction< + Vec4 Function(ffi.Pointer, Vec4) + >(_ObjCBlock_Vec4_Vec4_closureTrampoline) + .cast(); + +/// Construction methods for `objc.ObjCBlock`. +abstract final class ObjCBlock_Vec4_Vec4 { + /// Returns a block that wraps the given raw block pointer. + static objc.ObjCBlock castFromPointer( + ffi.Pointer pointer, { + bool retain = false, + bool release = false, + }) => objc.ObjCBlock( + pointer, + retain: retain, + release: release, + ); + + /// Creates a block from a C function pointer. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock fromFunctionPointer( + ffi.Pointer> ptr, + ) => objc.ObjCBlock( + objc.newPointerBlock(_ObjCBlock_Vec4_Vec4_fnPtrCallable, ptr.cast()), + retain: false, + release: true, + ); + + /// Creates a block from a Dart function. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + /// + /// If `keepIsolateAlive` is true, this block will keep this isolate alive + /// until it is garbage collected by both Dart and ObjC. + static objc.ObjCBlock fromFunction( + Vec4 Function(Vec4) fn, { + bool keepIsolateAlive = true, + }) => objc.ObjCBlock( + objc.newClosureBlock( + _ObjCBlock_Vec4_Vec4_closureCallable, + (Vec4 arg0) => fn(arg0), + keepIsolateAlive, + ), + retain: false, + release: true, + ); +} + +/// Call operator for `objc.ObjCBlock`. +extension ObjCBlock_Vec4_Vec4_CallExtension + on objc.ObjCBlock { + Vec4 call(Vec4 arg0) => + ref.pointer.ref.invoke + .cast< + ffi.NativeFunction< + Vec4 Function(ffi.Pointer block, Vec4 arg0) + > + >() + .asFunction, Vec4)>()( + ref.pointer, + arg0, + ); +} + +typedef Vec4Block = ffi.Pointer; +typedef DartVec4Block = objc.ObjCBlock; +typedef VoidBlock = ffi.Pointer; +typedef DartVoidBlock = objc.ObjCBlock; +void _ObjCBlock_ffiVoid_objcObjCSelector_fnPtrTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, +) => block.ref.target + .cast< + ffi.NativeFunction arg0)> + >() + .asFunction)>()(arg0); +ffi.Pointer _ObjCBlock_ffiVoid_objcObjCSelector_fnPtrCallable = + ffi.Pointer.fromFunction< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ) + >(_ObjCBlock_ffiVoid_objcObjCSelector_fnPtrTrampoline) + .cast(); +void _ObjCBlock_ffiVoid_objcObjCSelector_closureTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, +) => + (objc.getBlockClosure(block) + as void Function(ffi.Pointer))(arg0); +ffi.Pointer _ObjCBlock_ffiVoid_objcObjCSelector_closureCallable = + ffi.Pointer.fromFunction< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ) + >(_ObjCBlock_ffiVoid_objcObjCSelector_closureTrampoline) + .cast(); +void _ObjCBlock_ffiVoid_objcObjCSelector_sharedTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, +) { + final msg = (objc.objectRetain(block.cast()).cast(), arg0); + _ObjCBlock_ffiVoid_objcObjCSelector_listenerSendPort.send(msg); +} + +ffi.NativeCallable< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ) +> +_ObjCBlock_ffiVoid_objcObjCSelector_sharedCallable = + ffi.NativeCallable< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ) + >.isolateGroupShared(_ObjCBlock_ffiVoid_objcObjCSelector_sharedTrampoline) + ..keepIsolateAlive = false; +void _ObjCBlock_ffiVoid_objcObjCSelector_listenerTrampoline(dynamic msg) { + final ( + ffi.Pointer block, + ffi.Pointer arg0, + ) = msg; + (objc.getBlockClosure(block) + as void Function(ffi.Pointer))(arg0); + objc.objectRelease(block.cast()); +} + +final _ObjCBlock_ffiVoid_objcObjCSelector_listenerPort = RawReceivePort( + _ObjCBlock_ffiVoid_objcObjCSelector_listenerTrampoline, +)..keepIsolateAlive = false; +@pragma('vm:shared') +final _ObjCBlock_ffiVoid_objcObjCSelector_listenerSendPort = + _ObjCBlock_ffiVoid_objcObjCSelector_listenerPort.sendPort; +void _ObjCBlock_ffiVoid_objcObjCSelector_blockingTrampoline( + ffi.Pointer block, + ffi.Pointer waiter, + ffi.Pointer arg0, +) { + try { + (objc.getBlockClosure(block) + as void Function(ffi.Pointer))(arg0); + } catch (e) { + } finally { + objc.signalWaiter(waiter); + objc.objectRelease(block.cast()); + } +} + +ffi.NativeCallable< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ) +> +_ObjCBlock_ffiVoid_objcObjCSelector_blockingCallable = + ffi.NativeCallable< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ) + >.isolateLocal(_ObjCBlock_ffiVoid_objcObjCSelector_blockingTrampoline) + ..keepIsolateAlive = false; +ffi.NativeCallable< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ) +> +_ObjCBlock_ffiVoid_objcObjCSelector_blockingListenerCallable = + ffi.NativeCallable< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ) + >.listener(_ObjCBlock_ffiVoid_objcObjCSelector_blockingTrampoline) + ..keepIsolateAlive = false; + +/// Construction methods for `objc.ObjCBlock)>`. +abstract final class ObjCBlock_ffiVoid_objcObjCSelector { + /// Returns a block that wraps the given raw block pointer. + static objc.ObjCBlock)> + castFromPointer( + ffi.Pointer pointer, { + bool retain = false, + bool release = false, + }) => objc.ObjCBlock)>( + pointer, + retain: retain, + release: release, + ); + + /// Creates a block from a C function pointer. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock)> + fromFunctionPointer( + ffi.Pointer< + ffi.NativeFunction arg0)> + > + ptr, + ) => objc.ObjCBlock)>( + objc.newPointerBlock( + _ObjCBlock_ffiVoid_objcObjCSelector_fnPtrCallable, + ptr.cast(), + ), + retain: false, + release: true, + ); + + /// Creates a block from a Dart function. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + /// + /// If `keepIsolateAlive` is true, this block will keep this isolate alive + /// until it is garbage collected by both Dart and ObjC. + static objc.ObjCBlock)> + fromFunction( + void Function(ffi.Pointer) fn, { + bool keepIsolateAlive = true, + }) => objc.ObjCBlock)>( + objc.newClosureBlock( + _ObjCBlock_ffiVoid_objcObjCSelector_closureCallable, + (ffi.Pointer arg0) => fn(arg0), + keepIsolateAlive, + ), + retain: false, + release: true, + ); + + /// Creates a listener block from a Dart function. + /// + /// This is based on FFI's NativeCallable.listener, and has the same + /// capabilities and limitations. This block can be invoked from any thread, + /// but only supports void functions, and is not run synchronously. See + /// NativeCallable.listener for more details. + /// + /// If `keepIsolateAlive` is true, this block will keep this isolate alive + /// until it is garbage collected by both Dart and ObjC. + static objc.ObjCBlock)> + listener( + void Function(ffi.Pointer) fn, { + bool keepIsolateAlive = true, + }) { + final tramp = objc.newClosureBlock( + _ObjCBlock_ffiVoid_objcObjCSelector_sharedCallable.nativeFunction.cast(), + (ffi.Pointer arg0) => fn(arg0), + keepIsolateAlive, + ); + print( + 'listener send port: ' + + _ObjCBlock_ffiVoid_objcObjCSelector_listenerSendPort.toString(), + ); + return objc.ObjCBlock)>( + tramp, + retain: true, + release: true, + ); + } + + /// Creates a blocking block from a Dart function. + /// + /// This callback can be invoked from any native thread, and will block the + /// caller until the callback is handled by the Dart isolate that created + /// the block. Async functions are not supported. + /// + /// If `keepIsolateAlive` is true, this block will keep this isolate alive + /// until it is garbage collected by both Dart and ObjC. If the owner isolate + /// has shut down, and the block is invoked by native code, it may block + /// indefinitely, or have other undefined behavior. + static objc.ObjCBlock)> + blocking( + void Function(ffi.Pointer) fn, { + bool keepIsolateAlive = true, + }) { + final raw = objc.newClosureBlock( + _ObjCBlock_ffiVoid_objcObjCSelector_blockingCallable.nativeFunction + .cast(), + (ffi.Pointer arg0) => fn(arg0), + keepIsolateAlive, + ); + final rawListener = objc.newClosureBlock( + _ObjCBlock_ffiVoid_objcObjCSelector_blockingListenerCallable + .nativeFunction + .cast(), + (ffi.Pointer arg0) => fn(arg0), + keepIsolateAlive, + ); + final wrapper = _BlockTestObjCLibrary_wrapBlockingBlock_1d9e4oe( + raw, + rawListener, + objc.objCContext, + ); + objc.objectRelease(raw.cast()); + objc.objectRelease(rawListener.cast()); + return objc.ObjCBlock)>( + wrapper, + retain: false, + release: true, + ); + } +} + +/// Call operator for `objc.ObjCBlock)>`. +extension ObjCBlock_ffiVoid_objcObjCSelector_CallExtension + on objc.ObjCBlock)> { + void call(ffi.Pointer arg0) => ref.pointer.ref.invoke + .cast< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer block, + ffi.Pointer arg0, + ) + > + >() + .asFunction< + void Function( + ffi.Pointer, + ffi.Pointer, + ) + >()(ref.pointer, arg0); +} + +typedef SelectorBlock = ffi.Pointer; +typedef DartSelectorBlock = + objc.ObjCBlock)>; +ffi.Pointer _ObjCBlock_DummyObject_DummyObject_fnPtrTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, +) => block.ref.target + .cast< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer arg0) + > + >() + .asFunction< + ffi.Pointer Function(ffi.Pointer) + >()(arg0); +ffi.Pointer _ObjCBlock_DummyObject_DummyObject_fnPtrCallable = + ffi.Pointer.fromFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ) + >(_ObjCBlock_DummyObject_DummyObject_fnPtrTrampoline) + .cast(); +ffi.Pointer +_ObjCBlock_DummyObject_DummyObject_closureTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, +) => + (objc.getBlockClosure(block) + as ffi.Pointer Function(ffi.Pointer))( + arg0, + ); +ffi.Pointer _ObjCBlock_DummyObject_DummyObject_closureCallable = + ffi.Pointer.fromFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ) + >(_ObjCBlock_DummyObject_DummyObject_closureTrampoline) + .cast(); + +/// Construction methods for `objc.ObjCBlock`. +abstract final class ObjCBlock_DummyObject_DummyObject { + /// Returns a block that wraps the given raw block pointer. + static objc.ObjCBlock castFromPointer( + ffi.Pointer pointer, { + bool retain = false, + bool release = false, + }) => objc.ObjCBlock( + pointer, + retain: retain, + release: release, + ); + + /// Creates a block from a C function pointer. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock fromFunctionPointer( + ffi.Pointer< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer arg0) + > + > + ptr, + ) => objc.ObjCBlock( + objc.newPointerBlock( + _ObjCBlock_DummyObject_DummyObject_fnPtrCallable, + ptr.cast(), + ), + retain: false, + release: true, + ); + + /// Creates a block from a Dart function. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + /// + /// If `keepIsolateAlive` is true, this block will keep this isolate alive + /// until it is garbage collected by both Dart and ObjC. + static objc.ObjCBlock fromFunction( + DummyObject Function(DummyObject) fn, { + bool keepIsolateAlive = true, + }) => objc.ObjCBlock( + objc.newClosureBlock( + _ObjCBlock_DummyObject_DummyObject_closureCallable, + (ffi.Pointer arg0) => fn( + DummyObject.castFromPointer(arg0, retain: true, release: true), + ).ref.retainAndAutorelease(), + keepIsolateAlive, + ), + retain: false, + release: true, + ); +} + +/// Call operator for `objc.ObjCBlock`. +extension ObjCBlock_DummyObject_DummyObject_CallExtension + on objc.ObjCBlock { + DummyObject call(DummyObject arg0) => DummyObject.castFromPointer( + ref.pointer.ref.invoke + .cast< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer block, + ffi.Pointer arg0, + ) + > + >() + .asFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ) + >()(ref.pointer, arg0.ref.pointer), + retain: true, + release: true, + ); +} + +typedef ObjectBlock = ffi.Pointer; +typedef DartObjectBlock = objc.ObjCBlock; +ffi.Pointer +_ObjCBlock_DummyObject_DummyObject$1_fnPtrTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, +) => block.ref.target + .cast< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer arg0) + > + >() + .asFunction< + ffi.Pointer Function(ffi.Pointer) + >()(arg0); +ffi.Pointer _ObjCBlock_DummyObject_DummyObject$1_fnPtrCallable = + ffi.Pointer.fromFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ) + >(_ObjCBlock_DummyObject_DummyObject$1_fnPtrTrampoline) + .cast(); +ffi.Pointer +_ObjCBlock_DummyObject_DummyObject$1_closureTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, +) => + (objc.getBlockClosure(block) + as ffi.Pointer Function(ffi.Pointer))( + arg0, + ); +ffi.Pointer _ObjCBlock_DummyObject_DummyObject$1_closureCallable = + ffi.Pointer.fromFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ) + >(_ObjCBlock_DummyObject_DummyObject$1_closureTrampoline) + .cast(); + +/// Construction methods for `objc.ObjCBlock`. +abstract final class ObjCBlock_DummyObject_DummyObject$1 { + /// Returns a block that wraps the given raw block pointer. + static objc.ObjCBlock castFromPointer( + ffi.Pointer pointer, { + bool retain = false, + bool release = false, + }) => objc.ObjCBlock( + pointer, + retain: retain, + release: release, + ); + + /// Creates a block from a C function pointer. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock + fromFunctionPointer( + ffi.Pointer< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer arg0) + > + > + ptr, + ) => objc.ObjCBlock( + objc.newPointerBlock( + _ObjCBlock_DummyObject_DummyObject$1_fnPtrCallable, + ptr.cast(), + ), + retain: false, + release: true, + ); + + /// Creates a block from a Dart function. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + /// + /// If `keepIsolateAlive` is true, this block will keep this isolate alive + /// until it is garbage collected by both Dart and ObjC. + static objc.ObjCBlock fromFunction( + DummyObject? Function(DummyObject?) fn, { + bool keepIsolateAlive = true, + }) => objc.ObjCBlock( + objc.newClosureBlock( + _ObjCBlock_DummyObject_DummyObject$1_closureCallable, + (ffi.Pointer arg0) => + fn( + arg0.address == 0 + ? null + : DummyObject.castFromPointer( + arg0, + retain: true, + release: true, + ), + )?.ref.retainAndAutorelease() ?? + ffi.nullptr, + keepIsolateAlive, + ), + retain: false, + release: true, + ); +} + +/// Call operator for `objc.ObjCBlock`. +extension ObjCBlock_DummyObject_DummyObject$1_CallExtension + on objc.ObjCBlock { + DummyObject? call(DummyObject? arg0) => + ref.pointer.ref.invoke + .cast< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer block, + ffi.Pointer arg0, + ) + > + >() + .asFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ) + >()(ref.pointer, arg0?.ref.pointer ?? ffi.nullptr) + .address == + 0 + ? null + : DummyObject.castFromPointer( + ref.pointer.ref.invoke + .cast< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer block, + ffi.Pointer arg0, + ) + > + >() + .asFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ) + >()(ref.pointer, arg0?.ref.pointer ?? ffi.nullptr), + retain: true, + release: true, + ); +} + +typedef NullableObjectBlock = ffi.Pointer; +typedef DartNullableObjectBlock = + objc.ObjCBlock; +ffi.Pointer _ObjCBlock_NSString_NSString_fnPtrTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, +) => block.ref.target + .cast< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer arg0) + > + >() + .asFunction< + ffi.Pointer Function(ffi.Pointer) + >()(arg0); +ffi.Pointer _ObjCBlock_NSString_NSString_fnPtrCallable = + ffi.Pointer.fromFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ) + >(_ObjCBlock_NSString_NSString_fnPtrTrampoline) + .cast(); +ffi.Pointer _ObjCBlock_NSString_NSString_closureTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, +) => + (objc.getBlockClosure(block) + as ffi.Pointer Function(ffi.Pointer))( + arg0, + ); +ffi.Pointer _ObjCBlock_NSString_NSString_closureCallable = + ffi.Pointer.fromFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ) + >(_ObjCBlock_NSString_NSString_closureTrampoline) + .cast(); + +/// Construction methods for `objc.ObjCBlock`. +abstract final class ObjCBlock_NSString_NSString { + /// Returns a block that wraps the given raw block pointer. + static objc.ObjCBlock + castFromPointer( + ffi.Pointer pointer, { + bool retain = false, + bool release = false, + }) => objc.ObjCBlock( + pointer, + retain: retain, + release: release, + ); + + /// Creates a block from a C function pointer. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock + fromFunctionPointer( + ffi.Pointer< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer arg0) + > + > + ptr, + ) => objc.ObjCBlock( + objc.newPointerBlock( + _ObjCBlock_NSString_NSString_fnPtrCallable, + ptr.cast(), + ), + retain: false, + release: true, + ); + + /// Creates a block from a Dart function. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + /// + /// If `keepIsolateAlive` is true, this block will keep this isolate alive + /// until it is garbage collected by both Dart and ObjC. + static objc.ObjCBlock fromFunction( + objc.NSString? Function(objc.NSString?) fn, { + bool keepIsolateAlive = true, + }) => objc.ObjCBlock( + objc.newClosureBlock( + _ObjCBlock_NSString_NSString_closureCallable, + (ffi.Pointer arg0) => + fn( + arg0.address == 0 + ? null + : objc.NSString.castFromPointer( + arg0, + retain: true, + release: true, + ), + )?.ref.retainAndAutorelease() ?? + ffi.nullptr, + keepIsolateAlive, + ), + retain: false, + release: true, + ); +} + +/// Call operator for `objc.ObjCBlock`. +extension ObjCBlock_NSString_NSString_CallExtension + on objc.ObjCBlock { + objc.NSString? call(objc.NSString? arg0) => + ref.pointer.ref.invoke + .cast< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer block, + ffi.Pointer arg0, + ) + > + >() + .asFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ) + >()(ref.pointer, arg0?.ref.pointer ?? ffi.nullptr) + .address == + 0 + ? null + : objc.NSString.castFromPointer( + ref.pointer.ref.invoke + .cast< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer block, + ffi.Pointer arg0, + ) + > + >() + .asFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ) + >()(ref.pointer, arg0?.ref.pointer ?? ffi.nullptr), + retain: true, + release: true, + ); +} + +IntBlock _ObjCBlock_IntBlock_IntBlock_fnPtrTrampoline( + ffi.Pointer block, + IntBlock arg0, +) => block.ref.target + .cast>() + .asFunction()(arg0); +ffi.Pointer _ObjCBlock_IntBlock_IntBlock_fnPtrCallable = + ffi.Pointer.fromFunction< + IntBlock Function(ffi.Pointer, IntBlock) + >(_ObjCBlock_IntBlock_IntBlock_fnPtrTrampoline) + .cast(); +IntBlock _ObjCBlock_IntBlock_IntBlock_closureTrampoline( + ffi.Pointer block, + IntBlock arg0, +) => (objc.getBlockClosure(block) as IntBlock Function(IntBlock))(arg0); +ffi.Pointer _ObjCBlock_IntBlock_IntBlock_closureCallable = + ffi.Pointer.fromFunction< + IntBlock Function(ffi.Pointer, IntBlock) + >(_ObjCBlock_IntBlock_IntBlock_closureTrampoline) + .cast(); + +/// Construction methods for `objc.ObjCBlock Function(objc.ObjCBlock)>`. +abstract final class ObjCBlock_IntBlock_IntBlock { + /// Returns a block that wraps the given raw block pointer. + static objc.ObjCBlock< + objc.ObjCBlock Function( + objc.ObjCBlock, + ) + > + castFromPointer( + ffi.Pointer pointer, { + bool retain = false, + bool release = false, + }) => + objc.ObjCBlock< + objc.ObjCBlock Function( + objc.ObjCBlock, + ) + >(pointer, retain: retain, release: release); + + /// Creates a block from a C function pointer. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock< + objc.ObjCBlock Function( + objc.ObjCBlock, + ) + > + fromFunctionPointer( + ffi.Pointer> ptr, + ) => + objc.ObjCBlock< + objc.ObjCBlock Function( + objc.ObjCBlock, + ) + >( + objc.newPointerBlock( + _ObjCBlock_IntBlock_IntBlock_fnPtrCallable, + ptr.cast(), + ), + retain: false, + release: true, + ); + + /// Creates a block from a Dart function. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + /// + /// If `keepIsolateAlive` is true, this block will keep this isolate alive + /// until it is garbage collected by both Dart and ObjC. + static objc.ObjCBlock< + objc.ObjCBlock Function( + objc.ObjCBlock, + ) + > + fromFunction( + DartIntBlock Function(DartIntBlock) fn, { + bool keepIsolateAlive = true, + }) => + objc.ObjCBlock< + objc.ObjCBlock Function( + objc.ObjCBlock, + ) + >( + objc.newClosureBlock( + _ObjCBlock_IntBlock_IntBlock_closureCallable, + (IntBlock arg0) => fn( + ObjCBlock_Int32_Int32.castFromPointer( + arg0, + retain: true, + release: true, + ), + ).ref.retainAndAutorelease(), + keepIsolateAlive, + ), + retain: false, + release: true, + ); +} + +/// Call operator for `objc.ObjCBlock Function(objc.ObjCBlock)>`. +extension ObjCBlock_IntBlock_IntBlock_CallExtension + on + objc.ObjCBlock< + objc.ObjCBlock Function( + objc.ObjCBlock, + ) + > { + DartIntBlock call(DartIntBlock arg0) => ObjCBlock_Int32_Int32.castFromPointer( + ref.pointer.ref.invoke + .cast< + ffi.NativeFunction< + IntBlock Function( + ffi.Pointer block, + IntBlock arg0, + ) + > + >() + .asFunction< + IntBlock Function(ffi.Pointer, IntBlock) + >()(ref.pointer, arg0.ref.pointer), + retain: true, + release: true, + ); +} + +typedef BlockBlock = ffi.Pointer; +typedef DartBlockBlock = + objc.ObjCBlock< + objc.ObjCBlock Function( + objc.ObjCBlock, + ) + >; +void _ObjCBlock_ffiVoid_IntBlock_fnPtrTrampoline( + ffi.Pointer block, + IntBlock arg0, +) => block.ref.target + .cast>() + .asFunction()(arg0); +ffi.Pointer _ObjCBlock_ffiVoid_IntBlock_fnPtrCallable = + ffi.Pointer.fromFunction< + ffi.Void Function(ffi.Pointer, IntBlock) + >(_ObjCBlock_ffiVoid_IntBlock_fnPtrTrampoline) + .cast(); +void _ObjCBlock_ffiVoid_IntBlock_closureTrampoline( + ffi.Pointer block, + IntBlock arg0, +) => (objc.getBlockClosure(block) as void Function(IntBlock))(arg0); +ffi.Pointer _ObjCBlock_ffiVoid_IntBlock_closureCallable = + ffi.Pointer.fromFunction< + ffi.Void Function(ffi.Pointer, IntBlock) + >(_ObjCBlock_ffiVoid_IntBlock_closureTrampoline) + .cast(); +void _ObjCBlock_ffiVoid_IntBlock_sharedTrampoline( + ffi.Pointer block, + IntBlock arg0, +) { + final msg = ( + objc.objectRetain(block.cast()).cast(), + objc.blockRetain(arg0.cast()).cast(), + ); + _ObjCBlock_ffiVoid_IntBlock_listenerSendPort.send(msg); +} + +ffi.NativeCallable, IntBlock)> +_ObjCBlock_ffiVoid_IntBlock_sharedCallable = + ffi.NativeCallable< + ffi.Void Function(ffi.Pointer, IntBlock) + >.isolateGroupShared(_ObjCBlock_ffiVoid_IntBlock_sharedTrampoline) + ..keepIsolateAlive = false; +void _ObjCBlock_ffiVoid_IntBlock_listenerTrampoline(dynamic msg) { + final (ffi.Pointer block, IntBlock arg0) = msg; + (objc.getBlockClosure(block) as void Function(IntBlock))(arg0); + objc.objectRelease(block.cast()); +} + +final _ObjCBlock_ffiVoid_IntBlock_listenerPort = RawReceivePort( + _ObjCBlock_ffiVoid_IntBlock_listenerTrampoline, +)..keepIsolateAlive = false; +@pragma('vm:shared') +final _ObjCBlock_ffiVoid_IntBlock_listenerSendPort = + _ObjCBlock_ffiVoid_IntBlock_listenerPort.sendPort; +void _ObjCBlock_ffiVoid_IntBlock_blockingTrampoline( + ffi.Pointer block, + ffi.Pointer waiter, + IntBlock arg0, +) { + try { + (objc.getBlockClosure(block) as void Function(IntBlock))(arg0); + } catch (e) { + } finally { + objc.signalWaiter(waiter); + objc.objectRelease(block.cast()); + } +} + +ffi.NativeCallable< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + IntBlock, + ) +> +_ObjCBlock_ffiVoid_IntBlock_blockingCallable = + ffi.NativeCallable< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + IntBlock, + ) + >.isolateLocal(_ObjCBlock_ffiVoid_IntBlock_blockingTrampoline) + ..keepIsolateAlive = false; +ffi.NativeCallable< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + IntBlock, + ) +> +_ObjCBlock_ffiVoid_IntBlock_blockingListenerCallable = + ffi.NativeCallable< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + IntBlock, + ) + >.listener(_ObjCBlock_ffiVoid_IntBlock_blockingTrampoline) + ..keepIsolateAlive = false; + +/// Construction methods for `objc.ObjCBlock)>`. +abstract final class ObjCBlock_ffiVoid_IntBlock { + /// Returns a block that wraps the given raw block pointer. + static objc.ObjCBlock< + ffi.Void Function(objc.ObjCBlock) + > + castFromPointer( + ffi.Pointer pointer, { + bool retain = false, + bool release = false, + }) => + objc.ObjCBlock< + ffi.Void Function(objc.ObjCBlock) + >(pointer, retain: retain, release: release); + + /// Creates a block from a C function pointer. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock< + ffi.Void Function(objc.ObjCBlock) + > + fromFunctionPointer( + ffi.Pointer> ptr, + ) => + objc.ObjCBlock< + ffi.Void Function(objc.ObjCBlock) + >( + objc.newPointerBlock( + _ObjCBlock_ffiVoid_IntBlock_fnPtrCallable, + ptr.cast(), + ), + retain: false, + release: true, + ); + + /// Creates a block from a Dart function. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + /// + /// If `keepIsolateAlive` is true, this block will keep this isolate alive + /// until it is garbage collected by both Dart and ObjC. + static objc.ObjCBlock< + ffi.Void Function(objc.ObjCBlock) + > + fromFunction( + void Function(DartIntBlock) fn, { + bool keepIsolateAlive = true, + }) => + objc.ObjCBlock< + ffi.Void Function(objc.ObjCBlock) + >( + objc.newClosureBlock( + _ObjCBlock_ffiVoid_IntBlock_closureCallable, + (IntBlock arg0) => fn( + ObjCBlock_Int32_Int32.castFromPointer( + arg0, + retain: true, + release: true, + ), + ), + keepIsolateAlive, + ), + retain: false, + release: true, + ); + + /// Creates a listener block from a Dart function. + /// + /// This is based on FFI's NativeCallable.listener, and has the same + /// capabilities and limitations. This block can be invoked from any thread, + /// but only supports void functions, and is not run synchronously. See + /// NativeCallable.listener for more details. + /// + /// If `keepIsolateAlive` is true, this block will keep this isolate alive + /// until it is garbage collected by both Dart and ObjC. + static objc.ObjCBlock< + ffi.Void Function(objc.ObjCBlock) + > + listener(void Function(DartIntBlock) fn, {bool keepIsolateAlive = true}) { + final tramp = objc.newClosureBlock( + _ObjCBlock_ffiVoid_IntBlock_sharedCallable.nativeFunction.cast(), + (IntBlock arg0) => fn( + ObjCBlock_Int32_Int32.castFromPointer( + arg0, + retain: false, + release: true, + ), + ), + keepIsolateAlive, + ); + print( + 'listener send port: ' + + _ObjCBlock_ffiVoid_IntBlock_listenerSendPort.toString(), + ); + return objc.ObjCBlock< + ffi.Void Function(objc.ObjCBlock) + >(tramp, retain: true, release: true); + } + + /// Creates a blocking block from a Dart function. + /// + /// This callback can be invoked from any native thread, and will block the + /// caller until the callback is handled by the Dart isolate that created + /// the block. Async functions are not supported. + /// + /// If `keepIsolateAlive` is true, this block will keep this isolate alive + /// until it is garbage collected by both Dart and ObjC. If the owner isolate + /// has shut down, and the block is invoked by native code, it may block + /// indefinitely, or have other undefined behavior. + static objc.ObjCBlock< + ffi.Void Function(objc.ObjCBlock) + > + blocking(void Function(DartIntBlock) fn, {bool keepIsolateAlive = true}) { + final raw = objc.newClosureBlock( + _ObjCBlock_ffiVoid_IntBlock_blockingCallable.nativeFunction.cast(), + (IntBlock arg0) => fn( + ObjCBlock_Int32_Int32.castFromPointer( + arg0, + retain: false, + release: true, + ), + ), + keepIsolateAlive, + ); + final rawListener = objc.newClosureBlock( + _ObjCBlock_ffiVoid_IntBlock_blockingListenerCallable.nativeFunction + .cast(), + (IntBlock arg0) => fn( + ObjCBlock_Int32_Int32.castFromPointer( + arg0, + retain: false, + release: true, + ), + ), + keepIsolateAlive, + ); + final wrapper = _BlockTestObjCLibrary_wrapBlockingBlock_f167m6( + raw, + rawListener, + objc.objCContext, + ); + objc.objectRelease(raw.cast()); + objc.objectRelease(rawListener.cast()); + return objc.ObjCBlock< + ffi.Void Function(objc.ObjCBlock) + >(wrapper, retain: false, release: true); + } +} + +/// Call operator for `objc.ObjCBlock)>`. +extension ObjCBlock_ffiVoid_IntBlock_CallExtension + on + objc.ObjCBlock< + ffi.Void Function(objc.ObjCBlock) + > { + void call(DartIntBlock arg0) => ref.pointer.ref.invoke + .cast< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer block, + IntBlock arg0, + ) + > + >() + .asFunction< + void Function(ffi.Pointer, IntBlock) + >()(ref.pointer, arg0.ref.pointer); +} + +typedef ListenerBlock = ffi.Pointer; +typedef DartListenerBlock = + objc.ObjCBlock< + ffi.Void Function(objc.ObjCBlock) + >; +void _ObjCBlock_ffiVoid_DummyObject_fnPtrTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, +) => block.ref.target + .cast< + ffi.NativeFunction arg0)> + >() + .asFunction)>()(arg0); +ffi.Pointer _ObjCBlock_ffiVoid_DummyObject_fnPtrCallable = + ffi.Pointer.fromFunction< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ) + >(_ObjCBlock_ffiVoid_DummyObject_fnPtrTrampoline) + .cast(); +void _ObjCBlock_ffiVoid_DummyObject_closureTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, +) => + (objc.getBlockClosure(block) + as void Function(ffi.Pointer))(arg0); +ffi.Pointer _ObjCBlock_ffiVoid_DummyObject_closureCallable = + ffi.Pointer.fromFunction< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ) + >(_ObjCBlock_ffiVoid_DummyObject_closureTrampoline) + .cast(); +void _ObjCBlock_ffiVoid_DummyObject_sharedTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, +) { + final msg = (objc.objectRetain(block.cast()).cast(), objc.objectRetain(arg0)); + _ObjCBlock_ffiVoid_DummyObject_listenerSendPort.send(msg); +} + +ffi.NativeCallable< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ) +> +_ObjCBlock_ffiVoid_DummyObject_sharedCallable = + ffi.NativeCallable< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ) + >.isolateGroupShared(_ObjCBlock_ffiVoid_DummyObject_sharedTrampoline) + ..keepIsolateAlive = false; +void _ObjCBlock_ffiVoid_DummyObject_listenerTrampoline(dynamic msg) { + final ( + ffi.Pointer block, + ffi.Pointer arg0, + ) = msg; + (objc.getBlockClosure(block) as void Function(ffi.Pointer))( + arg0, + ); + objc.objectRelease(block.cast()); +} + +final _ObjCBlock_ffiVoid_DummyObject_listenerPort = RawReceivePort( + _ObjCBlock_ffiVoid_DummyObject_listenerTrampoline, +)..keepIsolateAlive = false; +@pragma('vm:shared') +final _ObjCBlock_ffiVoid_DummyObject_listenerSendPort = + _ObjCBlock_ffiVoid_DummyObject_listenerPort.sendPort; +void _ObjCBlock_ffiVoid_DummyObject_blockingTrampoline( + ffi.Pointer block, + ffi.Pointer waiter, + ffi.Pointer arg0, +) { + try { + (objc.getBlockClosure(block) + as void Function(ffi.Pointer))(arg0); + } catch (e) { + } finally { + objc.signalWaiter(waiter); + objc.objectRelease(block.cast()); + } +} + +ffi.NativeCallable< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ) +> +_ObjCBlock_ffiVoid_DummyObject_blockingCallable = + ffi.NativeCallable< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ) + >.isolateLocal(_ObjCBlock_ffiVoid_DummyObject_blockingTrampoline) + ..keepIsolateAlive = false; +ffi.NativeCallable< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ) +> +_ObjCBlock_ffiVoid_DummyObject_blockingListenerCallable = + ffi.NativeCallable< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ) + >.listener(_ObjCBlock_ffiVoid_DummyObject_blockingTrampoline) + ..keepIsolateAlive = false; + +/// Construction methods for `objc.ObjCBlock`. +abstract final class ObjCBlock_ffiVoid_DummyObject { + /// Returns a block that wraps the given raw block pointer. + static objc.ObjCBlock castFromPointer( + ffi.Pointer pointer, { + bool retain = false, + bool release = false, + }) => objc.ObjCBlock( + pointer, + retain: retain, + release: release, + ); + + /// Creates a block from a C function pointer. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock fromFunctionPointer( + ffi.Pointer< + ffi.NativeFunction arg0)> + > + ptr, + ) => objc.ObjCBlock( + objc.newPointerBlock( + _ObjCBlock_ffiVoid_DummyObject_fnPtrCallable, + ptr.cast(), + ), + retain: false, + release: true, + ); + + /// Creates a block from a Dart function. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + /// + /// If `keepIsolateAlive` is true, this block will keep this isolate alive + /// until it is garbage collected by both Dart and ObjC. + static objc.ObjCBlock fromFunction( + void Function(DummyObject) fn, { + bool keepIsolateAlive = true, + }) => objc.ObjCBlock( + objc.newClosureBlock( + _ObjCBlock_ffiVoid_DummyObject_closureCallable, + (ffi.Pointer arg0) => + fn(DummyObject.castFromPointer(arg0, retain: true, release: true)), + keepIsolateAlive, + ), + retain: false, + release: true, + ); + + /// Creates a listener block from a Dart function. + /// + /// This is based on FFI's NativeCallable.listener, and has the same + /// capabilities and limitations. This block can be invoked from any thread, + /// but only supports void functions, and is not run synchronously. See + /// NativeCallable.listener for more details. + /// + /// If `keepIsolateAlive` is true, this block will keep this isolate alive + /// until it is garbage collected by both Dart and ObjC. + static objc.ObjCBlock listener( + void Function(DummyObject) fn, { + bool keepIsolateAlive = true, + }) { + final tramp = objc.newClosureBlock( + _ObjCBlock_ffiVoid_DummyObject_sharedCallable.nativeFunction.cast(), + (ffi.Pointer arg0) => + fn(DummyObject.castFromPointer(arg0, retain: false, release: true)), + keepIsolateAlive, + ); + print( + 'listener send port: ' + + _ObjCBlock_ffiVoid_DummyObject_listenerSendPort.toString(), + ); + return objc.ObjCBlock( + tramp, + retain: true, + release: true, + ); + } + + /// Creates a blocking block from a Dart function. + /// + /// This callback can be invoked from any native thread, and will block the + /// caller until the callback is handled by the Dart isolate that created + /// the block. Async functions are not supported. + /// + /// If `keepIsolateAlive` is true, this block will keep this isolate alive + /// until it is garbage collected by both Dart and ObjC. If the owner isolate + /// has shut down, and the block is invoked by native code, it may block + /// indefinitely, or have other undefined behavior. + static objc.ObjCBlock blocking( + void Function(DummyObject) fn, { + bool keepIsolateAlive = true, + }) { + final raw = objc.newClosureBlock( + _ObjCBlock_ffiVoid_DummyObject_blockingCallable.nativeFunction.cast(), + (ffi.Pointer arg0) => + fn(DummyObject.castFromPointer(arg0, retain: false, release: true)), + keepIsolateAlive, + ); + final rawListener = objc.newClosureBlock( + _ObjCBlock_ffiVoid_DummyObject_blockingListenerCallable.nativeFunction + .cast(), + (ffi.Pointer arg0) => + fn(DummyObject.castFromPointer(arg0, retain: false, release: true)), + keepIsolateAlive, + ); + final wrapper = _BlockTestObjCLibrary_wrapBlockingBlock_xtuoz7( + raw, + rawListener, + objc.objCContext, + ); + objc.objectRelease(raw.cast()); + objc.objectRelease(rawListener.cast()); + return objc.ObjCBlock( + wrapper, + retain: false, + release: true, + ); + } +} + +/// Call operator for `objc.ObjCBlock`. +extension ObjCBlock_ffiVoid_DummyObject_CallExtension + on objc.ObjCBlock { + void call(DummyObject arg0) => ref.pointer.ref.invoke + .cast< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer block, + ffi.Pointer arg0, + ) + > + >() + .asFunction< + void Function( + ffi.Pointer, + ffi.Pointer, + ) + >()(ref.pointer, arg0.ref.pointer); +} + +typedef ObjectListenerBlock = ffi.Pointer; +typedef DartObjectListenerBlock = + objc.ObjCBlock; +void _ObjCBlock_ffiVoid_DummyObject$1_fnPtrTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, +) => block.ref.target + .cast< + ffi.NativeFunction arg0)> + >() + .asFunction)>()(arg0); +ffi.Pointer _ObjCBlock_ffiVoid_DummyObject$1_fnPtrCallable = + ffi.Pointer.fromFunction< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ) + >(_ObjCBlock_ffiVoid_DummyObject$1_fnPtrTrampoline) + .cast(); +void _ObjCBlock_ffiVoid_DummyObject$1_closureTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, +) => + (objc.getBlockClosure(block) + as void Function(ffi.Pointer))(arg0); +ffi.Pointer _ObjCBlock_ffiVoid_DummyObject$1_closureCallable = + ffi.Pointer.fromFunction< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ) + >(_ObjCBlock_ffiVoid_DummyObject$1_closureTrampoline) + .cast(); +void _ObjCBlock_ffiVoid_DummyObject$1_sharedTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, +) { + final msg = (objc.objectRetain(block.cast()).cast(), objc.objectRetain(arg0)); + _ObjCBlock_ffiVoid_DummyObject$1_listenerSendPort.send(msg); +} + +ffi.NativeCallable< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ) +> +_ObjCBlock_ffiVoid_DummyObject$1_sharedCallable = + ffi.NativeCallable< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ) + >.isolateGroupShared(_ObjCBlock_ffiVoid_DummyObject$1_sharedTrampoline) + ..keepIsolateAlive = false; +void _ObjCBlock_ffiVoid_DummyObject$1_listenerTrampoline(dynamic msg) { + final ( + ffi.Pointer block, + ffi.Pointer arg0, + ) = msg; + (objc.getBlockClosure(block) as void Function(ffi.Pointer))( + arg0, + ); + objc.objectRelease(block.cast()); +} + +final _ObjCBlock_ffiVoid_DummyObject$1_listenerPort = RawReceivePort( + _ObjCBlock_ffiVoid_DummyObject$1_listenerTrampoline, +)..keepIsolateAlive = false; +@pragma('vm:shared') +final _ObjCBlock_ffiVoid_DummyObject$1_listenerSendPort = + _ObjCBlock_ffiVoid_DummyObject$1_listenerPort.sendPort; +void _ObjCBlock_ffiVoid_DummyObject$1_blockingTrampoline( + ffi.Pointer block, + ffi.Pointer waiter, + ffi.Pointer arg0, +) { + try { + (objc.getBlockClosure(block) + as void Function(ffi.Pointer))(arg0); + } catch (e) { + } finally { + objc.signalWaiter(waiter); + objc.objectRelease(block.cast()); + } +} + +ffi.NativeCallable< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ) +> +_ObjCBlock_ffiVoid_DummyObject$1_blockingCallable = + ffi.NativeCallable< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ) + >.isolateLocal(_ObjCBlock_ffiVoid_DummyObject$1_blockingTrampoline) + ..keepIsolateAlive = false; +ffi.NativeCallable< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ) +> +_ObjCBlock_ffiVoid_DummyObject$1_blockingListenerCallable = + ffi.NativeCallable< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ) + >.listener(_ObjCBlock_ffiVoid_DummyObject$1_blockingTrampoline) + ..keepIsolateAlive = false; + +/// Construction methods for `objc.ObjCBlock`. +abstract final class ObjCBlock_ffiVoid_DummyObject$1 { + /// Returns a block that wraps the given raw block pointer. + static objc.ObjCBlock castFromPointer( + ffi.Pointer pointer, { + bool retain = false, + bool release = false, + }) => objc.ObjCBlock( + pointer, + retain: retain, + release: release, + ); + + /// Creates a block from a C function pointer. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock fromFunctionPointer( + ffi.Pointer< + ffi.NativeFunction arg0)> + > + ptr, + ) => objc.ObjCBlock( + objc.newPointerBlock( + _ObjCBlock_ffiVoid_DummyObject$1_fnPtrCallable, + ptr.cast(), + ), + retain: false, + release: true, + ); + + /// Creates a block from a Dart function. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + /// + /// If `keepIsolateAlive` is true, this block will keep this isolate alive + /// until it is garbage collected by both Dart and ObjC. + static objc.ObjCBlock fromFunction( + void Function(DummyObject?) fn, { + bool keepIsolateAlive = true, + }) => objc.ObjCBlock( + objc.newClosureBlock( + _ObjCBlock_ffiVoid_DummyObject$1_closureCallable, + (ffi.Pointer arg0) => fn( + arg0.address == 0 + ? null + : DummyObject.castFromPointer(arg0, retain: true, release: true), + ), + keepIsolateAlive, + ), + retain: false, + release: true, + ); + + /// Creates a listener block from a Dart function. + /// + /// This is based on FFI's NativeCallable.listener, and has the same + /// capabilities and limitations. This block can be invoked from any thread, + /// but only supports void functions, and is not run synchronously. See + /// NativeCallable.listener for more details. + /// + /// If `keepIsolateAlive` is true, this block will keep this isolate alive + /// until it is garbage collected by both Dart and ObjC. + static objc.ObjCBlock listener( + void Function(DummyObject?) fn, { + bool keepIsolateAlive = true, + }) { + final tramp = objc.newClosureBlock( + _ObjCBlock_ffiVoid_DummyObject$1_sharedCallable.nativeFunction.cast(), + (ffi.Pointer arg0) => fn( + arg0.address == 0 + ? null + : DummyObject.castFromPointer(arg0, retain: false, release: true), + ), + keepIsolateAlive, + ); + print( + 'listener send port: ' + + _ObjCBlock_ffiVoid_DummyObject$1_listenerSendPort.toString(), + ); + return objc.ObjCBlock( + tramp, + retain: true, + release: true, + ); + } + + /// Creates a blocking block from a Dart function. + /// + /// This callback can be invoked from any native thread, and will block the + /// caller until the callback is handled by the Dart isolate that created + /// the block. Async functions are not supported. + /// + /// If `keepIsolateAlive` is true, this block will keep this isolate alive + /// until it is garbage collected by both Dart and ObjC. If the owner isolate + /// has shut down, and the block is invoked by native code, it may block + /// indefinitely, or have other undefined behavior. + static objc.ObjCBlock blocking( + void Function(DummyObject?) fn, { + bool keepIsolateAlive = true, + }) { + final raw = objc.newClosureBlock( + _ObjCBlock_ffiVoid_DummyObject$1_blockingCallable.nativeFunction.cast(), + (ffi.Pointer arg0) => fn( + arg0.address == 0 + ? null + : DummyObject.castFromPointer(arg0, retain: false, release: true), + ), + keepIsolateAlive, + ); + final rawListener = objc.newClosureBlock( + _ObjCBlock_ffiVoid_DummyObject$1_blockingListenerCallable.nativeFunction + .cast(), + (ffi.Pointer arg0) => fn( + arg0.address == 0 + ? null + : DummyObject.castFromPointer(arg0, retain: false, release: true), + ), + keepIsolateAlive, + ); + final wrapper = _BlockTestObjCLibrary_wrapBlockingBlock_xtuoz7( + raw, + rawListener, + objc.objCContext, + ); + objc.objectRelease(raw.cast()); + objc.objectRelease(rawListener.cast()); + return objc.ObjCBlock( + wrapper, + retain: false, + release: true, + ); + } +} + +/// Call operator for `objc.ObjCBlock`. +extension ObjCBlock_ffiVoid_DummyObject$1_CallExtension + on objc.ObjCBlock { + void call(DummyObject? arg0) => ref.pointer.ref.invoke + .cast< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer block, + ffi.Pointer arg0, + ) + > + >() + .asFunction< + void Function( + ffi.Pointer, + ffi.Pointer, + ) + >()(ref.pointer, arg0?.ref.pointer ?? ffi.nullptr); +} + +typedef NullableListenerBlock = ffi.Pointer; +typedef DartNullableListenerBlock = + objc.ObjCBlock; +void _ObjCBlock_ffiVoid_Vec2_Vec4_NSObject_fnPtrTrampoline( + ffi.Pointer block, + Vec2 arg0, + Vec4 arg1, + ffi.Pointer arg2, +) => + block.ref.target + .cast< + ffi.NativeFunction< + ffi.Void Function( + Vec2 arg0, + Vec4 arg1, + ffi.Pointer arg2, + ) + > + >() + .asFunction)>()( + arg0, + arg1, + arg2, + ); +ffi.Pointer _ObjCBlock_ffiVoid_Vec2_Vec4_NSObject_fnPtrCallable = + ffi.Pointer.fromFunction< + ffi.Void Function( + ffi.Pointer, + Vec2, + Vec4, + ffi.Pointer, + ) + >(_ObjCBlock_ffiVoid_Vec2_Vec4_NSObject_fnPtrTrampoline) + .cast(); +void _ObjCBlock_ffiVoid_Vec2_Vec4_NSObject_closureTrampoline( + ffi.Pointer block, + Vec2 arg0, + Vec4 arg1, + ffi.Pointer arg2, +) => + (objc.getBlockClosure(block) + as void Function(Vec2, Vec4, ffi.Pointer))( + arg0, + arg1, + arg2, + ); +ffi.Pointer _ObjCBlock_ffiVoid_Vec2_Vec4_NSObject_closureCallable = + ffi.Pointer.fromFunction< + ffi.Void Function( + ffi.Pointer, + Vec2, + Vec4, + ffi.Pointer, + ) + >(_ObjCBlock_ffiVoid_Vec2_Vec4_NSObject_closureTrampoline) + .cast(); +void _ObjCBlock_ffiVoid_Vec2_Vec4_NSObject_sharedTrampoline( + ffi.Pointer block, + Vec2 arg0, + Vec4 arg1, + ffi.Pointer arg2, +) { + final msg = ( + objc.objectRetain(block.cast()).cast(), + arg0, + arg1, + objc.objectRetain(arg2), + ); + _ObjCBlock_ffiVoid_Vec2_Vec4_NSObject_listenerSendPort.send(msg); +} + +ffi.NativeCallable< + ffi.Void Function( + ffi.Pointer, + Vec2, + Vec4, + ffi.Pointer, + ) +> +_ObjCBlock_ffiVoid_Vec2_Vec4_NSObject_sharedCallable = + ffi.NativeCallable< + ffi.Void Function( + ffi.Pointer, + Vec2, + Vec4, + ffi.Pointer, + ) + >.isolateGroupShared( + _ObjCBlock_ffiVoid_Vec2_Vec4_NSObject_sharedTrampoline, + ) + ..keepIsolateAlive = false; +void _ObjCBlock_ffiVoid_Vec2_Vec4_NSObject_listenerTrampoline(dynamic msg) { + final ( + ffi.Pointer block, + Vec2 arg0, + Vec4 arg1, + ffi.Pointer arg2, + ) = msg; + (objc.getBlockClosure(block) + as void Function(Vec2, Vec4, ffi.Pointer))( + arg0, + arg1, + arg2, + ); + objc.objectRelease(block.cast()); +} + +final _ObjCBlock_ffiVoid_Vec2_Vec4_NSObject_listenerPort = RawReceivePort( + _ObjCBlock_ffiVoid_Vec2_Vec4_NSObject_listenerTrampoline, +)..keepIsolateAlive = false; +@pragma('vm:shared') +final _ObjCBlock_ffiVoid_Vec2_Vec4_NSObject_listenerSendPort = + _ObjCBlock_ffiVoid_Vec2_Vec4_NSObject_listenerPort.sendPort; +void _ObjCBlock_ffiVoid_Vec2_Vec4_NSObject_blockingTrampoline( + ffi.Pointer block, + ffi.Pointer waiter, + Vec2 arg0, + Vec4 arg1, + ffi.Pointer arg2, +) { + try { + (objc.getBlockClosure(block) + as void Function(Vec2, Vec4, ffi.Pointer))( + arg0, + arg1, + arg2, + ); + } catch (e) { + } finally { + objc.signalWaiter(waiter); + objc.objectRelease(block.cast()); + } +} + +ffi.NativeCallable< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + Vec2, + Vec4, + ffi.Pointer, + ) +> +_ObjCBlock_ffiVoid_Vec2_Vec4_NSObject_blockingCallable = + ffi.NativeCallable< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + Vec2, + Vec4, + ffi.Pointer, + ) + >.isolateLocal(_ObjCBlock_ffiVoid_Vec2_Vec4_NSObject_blockingTrampoline) + ..keepIsolateAlive = false; +ffi.NativeCallable< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + Vec2, + Vec4, + ffi.Pointer, + ) +> +_ObjCBlock_ffiVoid_Vec2_Vec4_NSObject_blockingListenerCallable = + ffi.NativeCallable< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + Vec2, + Vec4, + ffi.Pointer, + ) + >.listener(_ObjCBlock_ffiVoid_Vec2_Vec4_NSObject_blockingTrampoline) + ..keepIsolateAlive = false; + +/// Construction methods for `objc.ObjCBlock`. +abstract final class ObjCBlock_ffiVoid_Vec2_Vec4_NSObject { + /// Returns a block that wraps the given raw block pointer. + static objc.ObjCBlock + castFromPointer( + ffi.Pointer pointer, { + bool retain = false, + bool release = false, + }) => objc.ObjCBlock( + pointer, + retain: retain, + release: release, + ); + + /// Creates a block from a C function pointer. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock + fromFunctionPointer( + ffi.Pointer< + ffi.NativeFunction< + ffi.Void Function( + Vec2 arg0, + Vec4 arg1, + ffi.Pointer arg2, + ) + > + > + ptr, + ) => objc.ObjCBlock( + objc.newPointerBlock( + _ObjCBlock_ffiVoid_Vec2_Vec4_NSObject_fnPtrCallable, + ptr.cast(), + ), + retain: false, + release: true, + ); + + /// Creates a block from a Dart function. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + /// + /// If `keepIsolateAlive` is true, this block will keep this isolate alive + /// until it is garbage collected by both Dart and ObjC. + static objc.ObjCBlock + fromFunction( + void Function(Vec2, Vec4, objc.NSObject) fn, { + bool keepIsolateAlive = true, + }) => objc.ObjCBlock( + objc.newClosureBlock( + _ObjCBlock_ffiVoid_Vec2_Vec4_NSObject_closureCallable, + (Vec2 arg0, Vec4 arg1, ffi.Pointer arg2) => fn( + arg0, + arg1, + objc.NSObject.castFromPointer(arg2, retain: true, release: true), + ), + keepIsolateAlive, + ), + retain: false, + release: true, + ); + + /// Creates a listener block from a Dart function. + /// + /// This is based on FFI's NativeCallable.listener, and has the same + /// capabilities and limitations. This block can be invoked from any thread, + /// but only supports void functions, and is not run synchronously. See + /// NativeCallable.listener for more details. + /// + /// If `keepIsolateAlive` is true, this block will keep this isolate alive + /// until it is garbage collected by both Dart and ObjC. + static objc.ObjCBlock listener( + void Function(Vec2, Vec4, objc.NSObject) fn, { + bool keepIsolateAlive = true, + }) { + final tramp = objc.newClosureBlock( + _ObjCBlock_ffiVoid_Vec2_Vec4_NSObject_sharedCallable.nativeFunction + .cast(), + (Vec2 arg0, Vec4 arg1, ffi.Pointer arg2) => fn( + arg0, + arg1, + objc.NSObject.castFromPointer(arg2, retain: false, release: true), + ), + keepIsolateAlive, + ); + print( + 'listener send port: ' + + _ObjCBlock_ffiVoid_Vec2_Vec4_NSObject_listenerSendPort.toString(), + ); + return objc.ObjCBlock( + tramp, + retain: true, + release: true, + ); + } + + /// Creates a blocking block from a Dart function. + /// + /// This callback can be invoked from any native thread, and will block the + /// caller until the callback is handled by the Dart isolate that created + /// the block. Async functions are not supported. + /// + /// If `keepIsolateAlive` is true, this block will keep this isolate alive + /// until it is garbage collected by both Dart and ObjC. If the owner isolate + /// has shut down, and the block is invoked by native code, it may block + /// indefinitely, or have other undefined behavior. + static objc.ObjCBlock blocking( + void Function(Vec2, Vec4, objc.NSObject) fn, { + bool keepIsolateAlive = true, + }) { + final raw = objc.newClosureBlock( + _ObjCBlock_ffiVoid_Vec2_Vec4_NSObject_blockingCallable.nativeFunction + .cast(), + (Vec2 arg0, Vec4 arg1, ffi.Pointer arg2) => fn( + arg0, + arg1, + objc.NSObject.castFromPointer(arg2, retain: false, release: true), + ), + keepIsolateAlive, + ); + final rawListener = objc.newClosureBlock( + _ObjCBlock_ffiVoid_Vec2_Vec4_NSObject_blockingListenerCallable + .nativeFunction + .cast(), + (Vec2 arg0, Vec4 arg1, ffi.Pointer arg2) => fn( + arg0, + arg1, + objc.NSObject.castFromPointer(arg2, retain: false, release: true), + ), + keepIsolateAlive, + ); + final wrapper = _BlockTestObjCLibrary_wrapBlockingBlock_ru30ue( + raw, + rawListener, + objc.objCContext, + ); + objc.objectRelease(raw.cast()); + objc.objectRelease(rawListener.cast()); + return objc.ObjCBlock( + wrapper, + retain: false, + release: true, + ); + } +} + +/// Call operator for `objc.ObjCBlock`. +extension ObjCBlock_ffiVoid_Vec2_Vec4_NSObject_CallExtension + on objc.ObjCBlock { + void call(Vec2 arg0, Vec4 arg1, objc.NSObject arg2) => ref.pointer.ref.invoke + .cast< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer block, + Vec2 arg0, + Vec4 arg1, + ffi.Pointer arg2, + ) + > + >() + .asFunction< + void Function( + ffi.Pointer, + Vec2, + Vec4, + ffi.Pointer, + ) + >()(ref.pointer, arg0, arg1, arg2.ref.pointer); +} + +typedef StructListenerBlock = ffi.Pointer; +typedef DartStructListenerBlock = + objc.ObjCBlock; +void _ObjCBlock_ffiVoid_NSString_fnPtrTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, +) => block.ref.target + .cast< + ffi.NativeFunction arg0)> + >() + .asFunction)>()(arg0); +ffi.Pointer _ObjCBlock_ffiVoid_NSString_fnPtrCallable = + ffi.Pointer.fromFunction< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ) + >(_ObjCBlock_ffiVoid_NSString_fnPtrTrampoline) + .cast(); +void _ObjCBlock_ffiVoid_NSString_closureTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, +) => + (objc.getBlockClosure(block) + as void Function(ffi.Pointer))(arg0); +ffi.Pointer _ObjCBlock_ffiVoid_NSString_closureCallable = + ffi.Pointer.fromFunction< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ) + >(_ObjCBlock_ffiVoid_NSString_closureTrampoline) + .cast(); +void _ObjCBlock_ffiVoid_NSString_sharedTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, +) { + final msg = (objc.objectRetain(block.cast()).cast(), objc.objectRetain(arg0)); + _ObjCBlock_ffiVoid_NSString_listenerSendPort.send(msg); +} + +ffi.NativeCallable< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ) +> +_ObjCBlock_ffiVoid_NSString_sharedCallable = + ffi.NativeCallable< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ) + >.isolateGroupShared(_ObjCBlock_ffiVoid_NSString_sharedTrampoline) + ..keepIsolateAlive = false; +void _ObjCBlock_ffiVoid_NSString_listenerTrampoline(dynamic msg) { + final ( + ffi.Pointer block, + ffi.Pointer arg0, + ) = msg; + (objc.getBlockClosure(block) as void Function(ffi.Pointer))( + arg0, + ); + objc.objectRelease(block.cast()); +} + +final _ObjCBlock_ffiVoid_NSString_listenerPort = RawReceivePort( + _ObjCBlock_ffiVoid_NSString_listenerTrampoline, +)..keepIsolateAlive = false; +@pragma('vm:shared') +final _ObjCBlock_ffiVoid_NSString_listenerSendPort = + _ObjCBlock_ffiVoid_NSString_listenerPort.sendPort; +void _ObjCBlock_ffiVoid_NSString_blockingTrampoline( + ffi.Pointer block, + ffi.Pointer waiter, + ffi.Pointer arg0, +) { + try { + (objc.getBlockClosure(block) + as void Function(ffi.Pointer))(arg0); + } catch (e) { + } finally { + objc.signalWaiter(waiter); + objc.objectRelease(block.cast()); + } +} + +ffi.NativeCallable< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ) +> +_ObjCBlock_ffiVoid_NSString_blockingCallable = + ffi.NativeCallable< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ) + >.isolateLocal(_ObjCBlock_ffiVoid_NSString_blockingTrampoline) + ..keepIsolateAlive = false; +ffi.NativeCallable< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ) +> +_ObjCBlock_ffiVoid_NSString_blockingListenerCallable = + ffi.NativeCallable< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ) + >.listener(_ObjCBlock_ffiVoid_NSString_blockingTrampoline) + ..keepIsolateAlive = false; + +/// Construction methods for `objc.ObjCBlock`. +abstract final class ObjCBlock_ffiVoid_NSString { + /// Returns a block that wraps the given raw block pointer. + static objc.ObjCBlock castFromPointer( + ffi.Pointer pointer, { + bool retain = false, + bool release = false, + }) => objc.ObjCBlock( + pointer, + retain: retain, + release: release, + ); + + /// Creates a block from a C function pointer. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock fromFunctionPointer( + ffi.Pointer< + ffi.NativeFunction arg0)> + > + ptr, + ) => objc.ObjCBlock( + objc.newPointerBlock(_ObjCBlock_ffiVoid_NSString_fnPtrCallable, ptr.cast()), + retain: false, + release: true, + ); + + /// Creates a block from a Dart function. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + /// + /// If `keepIsolateAlive` is true, this block will keep this isolate alive + /// until it is garbage collected by both Dart and ObjC. + static objc.ObjCBlock fromFunction( + void Function(objc.NSString) fn, { + bool keepIsolateAlive = true, + }) => objc.ObjCBlock( + objc.newClosureBlock( + _ObjCBlock_ffiVoid_NSString_closureCallable, + (ffi.Pointer arg0) => + fn(objc.NSString.castFromPointer(arg0, retain: true, release: true)), + keepIsolateAlive, + ), + retain: false, + release: true, + ); + + /// Creates a listener block from a Dart function. + /// + /// This is based on FFI's NativeCallable.listener, and has the same + /// capabilities and limitations. This block can be invoked from any thread, + /// but only supports void functions, and is not run synchronously. See + /// NativeCallable.listener for more details. + /// + /// If `keepIsolateAlive` is true, this block will keep this isolate alive + /// until it is garbage collected by both Dart and ObjC. + static objc.ObjCBlock listener( + void Function(objc.NSString) fn, { + bool keepIsolateAlive = true, + }) { + final tramp = objc.newClosureBlock( + _ObjCBlock_ffiVoid_NSString_sharedCallable.nativeFunction.cast(), + (ffi.Pointer arg0) => + fn(objc.NSString.castFromPointer(arg0, retain: false, release: true)), + keepIsolateAlive, + ); + print( + 'listener send port: ' + + _ObjCBlock_ffiVoid_NSString_listenerSendPort.toString(), + ); + return objc.ObjCBlock( + tramp, + retain: true, + release: true, + ); + } + + /// Creates a blocking block from a Dart function. + /// + /// This callback can be invoked from any native thread, and will block the + /// caller until the callback is handled by the Dart isolate that created + /// the block. Async functions are not supported. + /// + /// If `keepIsolateAlive` is true, this block will keep this isolate alive + /// until it is garbage collected by both Dart and ObjC. If the owner isolate + /// has shut down, and the block is invoked by native code, it may block + /// indefinitely, or have other undefined behavior. + static objc.ObjCBlock blocking( + void Function(objc.NSString) fn, { + bool keepIsolateAlive = true, + }) { + final raw = objc.newClosureBlock( + _ObjCBlock_ffiVoid_NSString_blockingCallable.nativeFunction.cast(), + (ffi.Pointer arg0) => + fn(objc.NSString.castFromPointer(arg0, retain: false, release: true)), + keepIsolateAlive, + ); + final rawListener = objc.newClosureBlock( + _ObjCBlock_ffiVoid_NSString_blockingListenerCallable.nativeFunction + .cast(), + (ffi.Pointer arg0) => + fn(objc.NSString.castFromPointer(arg0, retain: false, release: true)), + keepIsolateAlive, + ); + final wrapper = _BlockTestObjCLibrary_wrapBlockingBlock_xtuoz7( + raw, + rawListener, + objc.objCContext, + ); + objc.objectRelease(raw.cast()); + objc.objectRelease(rawListener.cast()); + return objc.ObjCBlock( + wrapper, + retain: false, + release: true, + ); + } +} + +/// Call operator for `objc.ObjCBlock`. +extension ObjCBlock_ffiVoid_NSString_CallExtension + on objc.ObjCBlock { + void call(objc.NSString arg0) => ref.pointer.ref.invoke + .cast< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer block, + ffi.Pointer arg0, + ) + > + >() + .asFunction< + void Function( + ffi.Pointer, + ffi.Pointer, + ) + >()(ref.pointer, arg0.ref.pointer); +} + +typedef NSStringListenerBlock = ffi.Pointer; +typedef DartNSStringListenerBlock = + objc.ObjCBlock; +void _ObjCBlock_ffiVoid_Int32_Vec4_ffiChar_fnPtrTrampoline( + ffi.Pointer block, + int arg0, + Vec4 arg1, + ffi.Pointer arg2, +) => + block.ref.target + .cast< + ffi.NativeFunction< + ffi.Void Function( + ffi.Int32 arg0, + Vec4 arg1, + ffi.Pointer arg2, + ) + > + >() + .asFunction)>()( + arg0, + arg1, + arg2, + ); +ffi.Pointer _ObjCBlock_ffiVoid_Int32_Vec4_ffiChar_fnPtrCallable = + ffi.Pointer.fromFunction< + ffi.Void Function( + ffi.Pointer, + ffi.Int32, + Vec4, + ffi.Pointer, + ) + >(_ObjCBlock_ffiVoid_Int32_Vec4_ffiChar_fnPtrTrampoline) + .cast(); +void _ObjCBlock_ffiVoid_Int32_Vec4_ffiChar_closureTrampoline( + ffi.Pointer block, + int arg0, + Vec4 arg1, + ffi.Pointer arg2, +) => + (objc.getBlockClosure(block) + as void Function(int, Vec4, ffi.Pointer))(arg0, arg1, arg2); +ffi.Pointer _ObjCBlock_ffiVoid_Int32_Vec4_ffiChar_closureCallable = + ffi.Pointer.fromFunction< + ffi.Void Function( + ffi.Pointer, + ffi.Int32, + Vec4, + ffi.Pointer, + ) + >(_ObjCBlock_ffiVoid_Int32_Vec4_ffiChar_closureTrampoline) + .cast(); +void _ObjCBlock_ffiVoid_Int32_Vec4_ffiChar_sharedTrampoline( + ffi.Pointer block, + int arg0, + Vec4 arg1, + ffi.Pointer arg2, +) { + final msg = (objc.objectRetain(block.cast()).cast(), arg0, arg1, arg2); + _ObjCBlock_ffiVoid_Int32_Vec4_ffiChar_listenerSendPort.send(msg); +} + +ffi.NativeCallable< + ffi.Void Function( + ffi.Pointer, + ffi.Int32, + Vec4, + ffi.Pointer, + ) +> +_ObjCBlock_ffiVoid_Int32_Vec4_ffiChar_sharedCallable = + ffi.NativeCallable< + ffi.Void Function( + ffi.Pointer, + ffi.Int32, + Vec4, + ffi.Pointer, + ) + >.isolateGroupShared( + _ObjCBlock_ffiVoid_Int32_Vec4_ffiChar_sharedTrampoline, + ) + ..keepIsolateAlive = false; +void _ObjCBlock_ffiVoid_Int32_Vec4_ffiChar_listenerTrampoline(dynamic msg) { + final ( + ffi.Pointer block, + int arg0, + Vec4 arg1, + ffi.Pointer arg2, + ) = msg; + (objc.getBlockClosure(block) + as void Function(int, Vec4, ffi.Pointer))(arg0, arg1, arg2); + objc.objectRelease(block.cast()); +} + +final _ObjCBlock_ffiVoid_Int32_Vec4_ffiChar_listenerPort = RawReceivePort( + _ObjCBlock_ffiVoid_Int32_Vec4_ffiChar_listenerTrampoline, +)..keepIsolateAlive = false; +@pragma('vm:shared') +final _ObjCBlock_ffiVoid_Int32_Vec4_ffiChar_listenerSendPort = + _ObjCBlock_ffiVoid_Int32_Vec4_ffiChar_listenerPort.sendPort; +void _ObjCBlock_ffiVoid_Int32_Vec4_ffiChar_blockingTrampoline( + ffi.Pointer block, + ffi.Pointer waiter, + int arg0, + Vec4 arg1, + ffi.Pointer arg2, +) { + try { + (objc.getBlockClosure(block) + as void Function(int, Vec4, ffi.Pointer))(arg0, arg1, arg2); + } catch (e) { + } finally { + objc.signalWaiter(waiter); + objc.objectRelease(block.cast()); + } +} + +ffi.NativeCallable< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Int32, + Vec4, + ffi.Pointer, + ) +> +_ObjCBlock_ffiVoid_Int32_Vec4_ffiChar_blockingCallable = + ffi.NativeCallable< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Int32, + Vec4, + ffi.Pointer, + ) + >.isolateLocal(_ObjCBlock_ffiVoid_Int32_Vec4_ffiChar_blockingTrampoline) + ..keepIsolateAlive = false; +ffi.NativeCallable< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Int32, + Vec4, + ffi.Pointer, + ) +> +_ObjCBlock_ffiVoid_Int32_Vec4_ffiChar_blockingListenerCallable = + ffi.NativeCallable< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Int32, + Vec4, + ffi.Pointer, + ) + >.listener(_ObjCBlock_ffiVoid_Int32_Vec4_ffiChar_blockingTrampoline) + ..keepIsolateAlive = false; + +/// Construction methods for `objc.ObjCBlock)>`. +abstract final class ObjCBlock_ffiVoid_Int32_Vec4_ffiChar { + /// Returns a block that wraps the given raw block pointer. + static objc.ObjCBlock< + ffi.Void Function(ffi.Int32, Vec4, ffi.Pointer) + > + castFromPointer( + ffi.Pointer pointer, { + bool retain = false, + bool release = false, + }) => + objc.ObjCBlock)>( + pointer, + retain: retain, + release: release, + ); + + /// Creates a block from a C function pointer. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock< + ffi.Void Function(ffi.Int32, Vec4, ffi.Pointer) + > + fromFunctionPointer( + ffi.Pointer< + ffi.NativeFunction< + ffi.Void Function(ffi.Int32 arg0, Vec4 arg1, ffi.Pointer arg2) + > + > + ptr, + ) => + objc.ObjCBlock)>( + objc.newPointerBlock( + _ObjCBlock_ffiVoid_Int32_Vec4_ffiChar_fnPtrCallable, + ptr.cast(), + ), + retain: false, + release: true, + ); + + /// Creates a block from a Dart function. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + /// + /// If `keepIsolateAlive` is true, this block will keep this isolate alive + /// until it is garbage collected by both Dart and ObjC. + static objc.ObjCBlock< + ffi.Void Function(ffi.Int32, Vec4, ffi.Pointer) + > + fromFunction( + void Function(int, Vec4, ffi.Pointer) fn, { + bool keepIsolateAlive = true, + }) => + objc.ObjCBlock)>( + objc.newClosureBlock( + _ObjCBlock_ffiVoid_Int32_Vec4_ffiChar_closureCallable, + (int arg0, Vec4 arg1, ffi.Pointer arg2) => + fn(arg0, arg1, arg2), + keepIsolateAlive, + ), + retain: false, + release: true, + ); + + /// Creates a listener block from a Dart function. + /// + /// This is based on FFI's NativeCallable.listener, and has the same + /// capabilities and limitations. This block can be invoked from any thread, + /// but only supports void functions, and is not run synchronously. See + /// NativeCallable.listener for more details. + /// + /// If `keepIsolateAlive` is true, this block will keep this isolate alive + /// until it is garbage collected by both Dart and ObjC. + static objc.ObjCBlock< + ffi.Void Function(ffi.Int32, Vec4, ffi.Pointer) + > + listener( + void Function(int, Vec4, ffi.Pointer) fn, { + bool keepIsolateAlive = true, + }) { + final tramp = objc.newClosureBlock( + _ObjCBlock_ffiVoid_Int32_Vec4_ffiChar_sharedCallable.nativeFunction + .cast(), + (int arg0, Vec4 arg1, ffi.Pointer arg2) => fn(arg0, arg1, arg2), + keepIsolateAlive, + ); + print( + 'listener send port: ' + + _ObjCBlock_ffiVoid_Int32_Vec4_ffiChar_listenerSendPort.toString(), + ); + return objc.ObjCBlock< + ffi.Void Function(ffi.Int32, Vec4, ffi.Pointer) + >(tramp, retain: true, release: true); + } + + /// Creates a blocking block from a Dart function. + /// + /// This callback can be invoked from any native thread, and will block the + /// caller until the callback is handled by the Dart isolate that created + /// the block. Async functions are not supported. + /// + /// If `keepIsolateAlive` is true, this block will keep this isolate alive + /// until it is garbage collected by both Dart and ObjC. If the owner isolate + /// has shut down, and the block is invoked by native code, it may block + /// indefinitely, or have other undefined behavior. + static objc.ObjCBlock< + ffi.Void Function(ffi.Int32, Vec4, ffi.Pointer) + > + blocking( + void Function(int, Vec4, ffi.Pointer) fn, { + bool keepIsolateAlive = true, + }) { + final raw = objc.newClosureBlock( + _ObjCBlock_ffiVoid_Int32_Vec4_ffiChar_blockingCallable.nativeFunction + .cast(), + (int arg0, Vec4 arg1, ffi.Pointer arg2) => fn(arg0, arg1, arg2), + keepIsolateAlive, + ); + final rawListener = objc.newClosureBlock( + _ObjCBlock_ffiVoid_Int32_Vec4_ffiChar_blockingListenerCallable + .nativeFunction + .cast(), + (int arg0, Vec4 arg1, ffi.Pointer arg2) => fn(arg0, arg1, arg2), + keepIsolateAlive, + ); + final wrapper = _BlockTestObjCLibrary_wrapBlockingBlock_li50va( + raw, + rawListener, + objc.objCContext, + ); + objc.objectRelease(raw.cast()); + objc.objectRelease(rawListener.cast()); + return objc.ObjCBlock< + ffi.Void Function(ffi.Int32, Vec4, ffi.Pointer) + >(wrapper, retain: false, release: true); + } +} + +/// Call operator for `objc.ObjCBlock)>`. +extension ObjCBlock_ffiVoid_Int32_Vec4_ffiChar_CallExtension + on + objc.ObjCBlock< + ffi.Void Function(ffi.Int32, Vec4, ffi.Pointer) + > { + void call(int arg0, Vec4 arg1, ffi.Pointer arg2) => ref + .pointer + .ref + .invoke + .cast< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer block, + ffi.Int32 arg0, + Vec4 arg1, + ffi.Pointer arg2, + ) + > + >() + .asFunction< + void Function( + ffi.Pointer, + int, + Vec4, + ffi.Pointer, + ) + >()(ref.pointer, arg0, arg1, arg2); +} + +typedef NoTrampolineListenerBlock = ffi.Pointer; +typedef DartNoTrampolineListenerBlock = + objc.ObjCBlock)>; +void _ObjCBlock_ffiVoid_Int32_fnPtrTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, +) => block.ref.target + .cast arg0)>>() + .asFunction)>()(arg0); +ffi.Pointer _ObjCBlock_ffiVoid_Int32_fnPtrCallable = + ffi.Pointer.fromFunction< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ) + >(_ObjCBlock_ffiVoid_Int32_fnPtrTrampoline) + .cast(); +void _ObjCBlock_ffiVoid_Int32_closureTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, +) => (objc.getBlockClosure(block) as void Function(ffi.Pointer))( + arg0, +); +ffi.Pointer _ObjCBlock_ffiVoid_Int32_closureCallable = + ffi.Pointer.fromFunction< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ) + >(_ObjCBlock_ffiVoid_Int32_closureTrampoline) + .cast(); +void _ObjCBlock_ffiVoid_Int32_sharedTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, +) { + final msg = (objc.objectRetain(block.cast()).cast(), arg0); + _ObjCBlock_ffiVoid_Int32_listenerSendPort.send(msg); +} + +ffi.NativeCallable< + ffi.Void Function(ffi.Pointer, ffi.Pointer) +> +_ObjCBlock_ffiVoid_Int32_sharedCallable = + ffi.NativeCallable< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ) + >.isolateGroupShared(_ObjCBlock_ffiVoid_Int32_sharedTrampoline) + ..keepIsolateAlive = false; +void _ObjCBlock_ffiVoid_Int32_listenerTrampoline(dynamic msg) { + final (ffi.Pointer block, ffi.Pointer arg0) = + msg; + (objc.getBlockClosure(block) as void Function(ffi.Pointer))(arg0); + objc.objectRelease(block.cast()); +} + +final _ObjCBlock_ffiVoid_Int32_listenerPort = RawReceivePort( + _ObjCBlock_ffiVoid_Int32_listenerTrampoline, +)..keepIsolateAlive = false; +@pragma('vm:shared') +final _ObjCBlock_ffiVoid_Int32_listenerSendPort = + _ObjCBlock_ffiVoid_Int32_listenerPort.sendPort; +void _ObjCBlock_ffiVoid_Int32_blockingTrampoline( + ffi.Pointer block, + ffi.Pointer waiter, + ffi.Pointer arg0, +) { + try { + (objc.getBlockClosure(block) as void Function(ffi.Pointer))( + arg0, + ); + } catch (e) { + } finally { + objc.signalWaiter(waiter); + objc.objectRelease(block.cast()); + } +} + +ffi.NativeCallable< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ) +> +_ObjCBlock_ffiVoid_Int32_blockingCallable = + ffi.NativeCallable< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ) + >.isolateLocal(_ObjCBlock_ffiVoid_Int32_blockingTrampoline) + ..keepIsolateAlive = false; +ffi.NativeCallable< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ) +> +_ObjCBlock_ffiVoid_Int32_blockingListenerCallable = + ffi.NativeCallable< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ) + >.listener(_ObjCBlock_ffiVoid_Int32_blockingTrampoline) + ..keepIsolateAlive = false; + +/// Construction methods for `objc.ObjCBlock)>`. +abstract final class ObjCBlock_ffiVoid_Int32 { + /// Returns a block that wraps the given raw block pointer. + static objc.ObjCBlock)> + castFromPointer( + ffi.Pointer pointer, { + bool retain = false, + bool release = false, + }) => objc.ObjCBlock)>( + pointer, + retain: retain, + release: release, + ); + + /// Creates a block from a C function pointer. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock)> + fromFunctionPointer( + ffi.Pointer< + ffi.NativeFunction arg0)> + > + ptr, + ) => objc.ObjCBlock)>( + objc.newPointerBlock(_ObjCBlock_ffiVoid_Int32_fnPtrCallable, ptr.cast()), + retain: false, + release: true, + ); + + /// Creates a block from a Dart function. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + /// + /// If `keepIsolateAlive` is true, this block will keep this isolate alive + /// until it is garbage collected by both Dart and ObjC. + static objc.ObjCBlock)> fromFunction( + void Function(ffi.Pointer) fn, { + bool keepIsolateAlive = true, + }) => objc.ObjCBlock)>( + objc.newClosureBlock( + _ObjCBlock_ffiVoid_Int32_closureCallable, + (ffi.Pointer arg0) => fn(arg0), + keepIsolateAlive, + ), + retain: false, + release: true, + ); + + /// Creates a listener block from a Dart function. + /// + /// This is based on FFI's NativeCallable.listener, and has the same + /// capabilities and limitations. This block can be invoked from any thread, + /// but only supports void functions, and is not run synchronously. See + /// NativeCallable.listener for more details. + /// + /// If `keepIsolateAlive` is true, this block will keep this isolate alive + /// until it is garbage collected by both Dart and ObjC. + static objc.ObjCBlock)> listener( + void Function(ffi.Pointer) fn, { + bool keepIsolateAlive = true, + }) { + final tramp = objc.newClosureBlock( + _ObjCBlock_ffiVoid_Int32_sharedCallable.nativeFunction.cast(), + (ffi.Pointer arg0) => fn(arg0), + keepIsolateAlive, + ); + print( + 'listener send port: ' + + _ObjCBlock_ffiVoid_Int32_listenerSendPort.toString(), + ); + return objc.ObjCBlock)>( + tramp, + retain: true, + release: true, + ); + } + + /// Creates a blocking block from a Dart function. + /// + /// This callback can be invoked from any native thread, and will block the + /// caller until the callback is handled by the Dart isolate that created + /// the block. Async functions are not supported. + /// + /// If `keepIsolateAlive` is true, this block will keep this isolate alive + /// until it is garbage collected by both Dart and ObjC. If the owner isolate + /// has shut down, and the block is invoked by native code, it may block + /// indefinitely, or have other undefined behavior. + static objc.ObjCBlock)> blocking( + void Function(ffi.Pointer) fn, { + bool keepIsolateAlive = true, + }) { + final raw = objc.newClosureBlock( + _ObjCBlock_ffiVoid_Int32_blockingCallable.nativeFunction.cast(), + (ffi.Pointer arg0) => fn(arg0), + keepIsolateAlive, + ); + final rawListener = objc.newClosureBlock( + _ObjCBlock_ffiVoid_Int32_blockingListenerCallable.nativeFunction.cast(), + (ffi.Pointer arg0) => fn(arg0), + keepIsolateAlive, + ); + final wrapper = _BlockTestObjCLibrary_wrapBlockingBlock_yhkuco( + raw, + rawListener, + objc.objCContext, + ); + objc.objectRelease(raw.cast()); + objc.objectRelease(rawListener.cast()); + return objc.ObjCBlock)>( + wrapper, + retain: false, + release: true, + ); + } +} + +/// Call operator for `objc.ObjCBlock)>`. +extension ObjCBlock_ffiVoid_Int32_CallExtension + on objc.ObjCBlock)> { + void call(ffi.Pointer arg0) => ref.pointer.ref.invoke + .cast< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer block, + ffi.Pointer arg0, + ) + > + >() + .asFunction< + void Function(ffi.Pointer, ffi.Pointer) + >()(ref.pointer, arg0); +} + +void _ObjCBlock_ffiVoid_Int32$1_fnPtrTrampoline( + ffi.Pointer block, + int arg0, +) => block.ref.target + .cast>() + .asFunction()(arg0); +ffi.Pointer _ObjCBlock_ffiVoid_Int32$1_fnPtrCallable = + ffi.Pointer.fromFunction< + ffi.Void Function(ffi.Pointer, ffi.Int32) + >(_ObjCBlock_ffiVoid_Int32$1_fnPtrTrampoline) + .cast(); +void _ObjCBlock_ffiVoid_Int32$1_closureTrampoline( + ffi.Pointer block, + int arg0, +) => (objc.getBlockClosure(block) as void Function(int))(arg0); +ffi.Pointer _ObjCBlock_ffiVoid_Int32$1_closureCallable = + ffi.Pointer.fromFunction< + ffi.Void Function(ffi.Pointer, ffi.Int32) + >(_ObjCBlock_ffiVoid_Int32$1_closureTrampoline) + .cast(); +void _ObjCBlock_ffiVoid_Int32$1_sharedTrampoline( + ffi.Pointer block, + int arg0, +) { + final msg = (objc.objectRetain(block.cast()).cast(), arg0); + _ObjCBlock_ffiVoid_Int32$1_listenerSendPort.send(msg); +} + +ffi.NativeCallable< + ffi.Void Function(ffi.Pointer, ffi.Int32) +> +_ObjCBlock_ffiVoid_Int32$1_sharedCallable = + ffi.NativeCallable< + ffi.Void Function(ffi.Pointer, ffi.Int32) + >.isolateGroupShared(_ObjCBlock_ffiVoid_Int32$1_sharedTrampoline) + ..keepIsolateAlive = false; +void _ObjCBlock_ffiVoid_Int32$1_listenerTrampoline(dynamic msg) { + final (ffi.Pointer block, int arg0) = msg; + (objc.getBlockClosure(block) as void Function(int))(arg0); + objc.objectRelease(block.cast()); +} + +final _ObjCBlock_ffiVoid_Int32$1_listenerPort = RawReceivePort( + _ObjCBlock_ffiVoid_Int32$1_listenerTrampoline, +)..keepIsolateAlive = false; +@pragma('vm:shared') +final _ObjCBlock_ffiVoid_Int32$1_listenerSendPort = + _ObjCBlock_ffiVoid_Int32$1_listenerPort.sendPort; +void _ObjCBlock_ffiVoid_Int32$1_blockingTrampoline( + ffi.Pointer block, + ffi.Pointer waiter, + int arg0, +) { + try { + (objc.getBlockClosure(block) as void Function(int))(arg0); + } catch (e) { + } finally { + objc.signalWaiter(waiter); + objc.objectRelease(block.cast()); + } +} + +ffi.NativeCallable< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Int32, + ) +> +_ObjCBlock_ffiVoid_Int32$1_blockingCallable = + ffi.NativeCallable< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Int32, + ) + >.isolateLocal(_ObjCBlock_ffiVoid_Int32$1_blockingTrampoline) + ..keepIsolateAlive = false; +ffi.NativeCallable< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Int32, + ) +> +_ObjCBlock_ffiVoid_Int32$1_blockingListenerCallable = + ffi.NativeCallable< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Int32, + ) + >.listener(_ObjCBlock_ffiVoid_Int32$1_blockingTrampoline) + ..keepIsolateAlive = false; + +/// Construction methods for `objc.ObjCBlock`. +abstract final class ObjCBlock_ffiVoid_Int32$1 { + /// Returns a block that wraps the given raw block pointer. + static objc.ObjCBlock castFromPointer( + ffi.Pointer pointer, { + bool retain = false, + bool release = false, + }) => objc.ObjCBlock( + pointer, + retain: retain, + release: release, + ); + + /// Creates a block from a C function pointer. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock fromFunctionPointer( + ffi.Pointer> ptr, + ) => objc.ObjCBlock( + objc.newPointerBlock(_ObjCBlock_ffiVoid_Int32$1_fnPtrCallable, ptr.cast()), + retain: false, + release: true, + ); + + /// Creates a block from a Dart function. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + /// + /// If `keepIsolateAlive` is true, this block will keep this isolate alive + /// until it is garbage collected by both Dart and ObjC. + static objc.ObjCBlock fromFunction( + void Function(int) fn, { + bool keepIsolateAlive = true, + }) => objc.ObjCBlock( + objc.newClosureBlock( + _ObjCBlock_ffiVoid_Int32$1_closureCallable, + (int arg0) => fn(arg0), + keepIsolateAlive, + ), + retain: false, + release: true, + ); + + /// Creates a listener block from a Dart function. + /// + /// This is based on FFI's NativeCallable.listener, and has the same + /// capabilities and limitations. This block can be invoked from any thread, + /// but only supports void functions, and is not run synchronously. See + /// NativeCallable.listener for more details. + /// + /// If `keepIsolateAlive` is true, this block will keep this isolate alive + /// until it is garbage collected by both Dart and ObjC. + static objc.ObjCBlock listener( + void Function(int) fn, { + bool keepIsolateAlive = true, + }) { + final tramp = objc.newClosureBlock( + _ObjCBlock_ffiVoid_Int32$1_sharedCallable.nativeFunction.cast(), + (int arg0) => fn(arg0), + keepIsolateAlive, + ); + print( + 'listener send port: ' + + _ObjCBlock_ffiVoid_Int32$1_listenerSendPort.toString(), + ); + return objc.ObjCBlock( + tramp, + retain: true, + release: true, + ); + } + + /// Creates a blocking block from a Dart function. + /// + /// This callback can be invoked from any native thread, and will block the + /// caller until the callback is handled by the Dart isolate that created + /// the block. Async functions are not supported. + /// + /// If `keepIsolateAlive` is true, this block will keep this isolate alive + /// until it is garbage collected by both Dart and ObjC. If the owner isolate + /// has shut down, and the block is invoked by native code, it may block + /// indefinitely, or have other undefined behavior. + static objc.ObjCBlock blocking( + void Function(int) fn, { + bool keepIsolateAlive = true, + }) { + final raw = objc.newClosureBlock( + _ObjCBlock_ffiVoid_Int32$1_blockingCallable.nativeFunction.cast(), + (int arg0) => fn(arg0), + keepIsolateAlive, + ); + final rawListener = objc.newClosureBlock( + _ObjCBlock_ffiVoid_Int32$1_blockingListenerCallable.nativeFunction.cast(), + (int arg0) => fn(arg0), + keepIsolateAlive, + ); + final wrapper = _BlockTestObjCLibrary_wrapBlockingBlock_1bqef4y( + raw, + rawListener, + objc.objCContext, + ); + objc.objectRelease(raw.cast()); + objc.objectRelease(rawListener.cast()); + return objc.ObjCBlock( + wrapper, + retain: false, + release: true, + ); + } +} + +/// Call operator for `objc.ObjCBlock`. +extension ObjCBlock_ffiVoid_Int32$1_CallExtension + on objc.ObjCBlock { + void call(int arg0) => + ref.pointer.ref.invoke + .cast< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer block, + ffi.Int32 arg0, + ) + > + >() + .asFunction, int)>()( + ref.pointer, + arg0, + ); +} + +late final _class_BlockTester = objc.getClass("BlockTester"); +late final _sel_setup_ = objc.registerName("setup:"); +final _objc_msgSend_ovsamd = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ) + > + >() + .asFunction< + void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ) + >(); +late final _sel_newFromBlock_ = objc.registerName("newFromBlock:"); +late final _sel_newFromMultiplier_ = objc.registerName("newFromMultiplier:"); +final _objc_msgSend_aclumu = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ffi.Int32, + ) + > + >() + .asFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + int, + ) + >(); +late final _sel_newFromListener_ = objc.registerName("newFromListener:"); +late final _sel_call_ = objc.registerName("call:"); +final _objc_msgSend_zo3bvx = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Int32 Function( + ffi.Pointer, + ffi.Pointer, + ffi.Int32, + ) + > + >() + .asFunction< + int Function( + ffi.Pointer, + ffi.Pointer, + int, + ) + >(); +late final _sel_getBlock = objc.registerName("getBlock"); +final _objc_msgSend_uwvaik = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ) + > + >() + .asFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ) + >(); +late final _sel_pokeBlock = objc.registerName("pokeBlock"); +late final _sel_callOnSameThread_ = objc.registerName("callOnSameThread:"); +late final _sel_callOnSameThreadOutsideIsolate_ = objc.registerName( + "callOnSameThreadOutsideIsolate:", +); +late final _sel_callOnNewThread_ = objc.registerName("callOnNewThread:"); +late final _sel_callWithBlockOnNewThread_ = objc.registerName( + "callWithBlockOnNewThread:", +); +late final _sel_callFloatBlock_ = objc.registerName("callFloatBlock:"); +final _objc_msgSend_o8bnms = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Float Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ) + > + >() + .asFunction< + double Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ) + >(); +final _objc_msgSend_o8bnmsFpret = objc.msgSendFpretPointer + .cast< + ffi.NativeFunction< + ffi.Float Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ) + > + >() + .asFunction< + double Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ) + >(); +late final _sel_callDoubleBlock_ = objc.registerName("callDoubleBlock:"); +final _objc_msgSend_8mj2fv = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Double Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ) + > + >() + .asFunction< + double Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ) + >(); +final _objc_msgSend_8mj2fvFpret = objc.msgSendFpretPointer + .cast< + ffi.NativeFunction< + ffi.Double Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ) + > + >() + .asFunction< + double Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ) + >(); +late final _sel_callVec4Block_ = objc.registerName("callVec4Block:"); +final _objc_msgSend_1gew1vm = objc.msgSendPointer + .cast< + ffi.NativeFunction< + Vec4 Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ) + > + >() + .asFunction< + Vec4 Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ) + >(); +final _objc_msgSend_1gew1vmStret = objc.msgSendStretPointer + .cast< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ) + > + >() + .asFunction< + void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ) + >(); +late final _sel_callSelectorBlock_ = objc.registerName("callSelectorBlock:"); +late final _sel_callObjectBlock_ = objc.registerName("callObjectBlock:"); +late final _sel_callNullableObjectBlock_ = objc.registerName( + "callNullableObjectBlock:", +); +late final _sel_callNullableStringBlock_ = objc.registerName( + "callNullableStringBlock:", +); +late final _sel_callListener_ = objc.registerName("callListener:"); +late final _sel_callObjectListener_ = objc.registerName("callObjectListener:"); +late final _sel_callNullableListener_ = objc.registerName( + "callNullableListener:", +); +late final _sel_callStructListener_ = objc.registerName("callStructListener:"); +late final _sel_callNSStringListener_x_ = objc.registerName( + "callNSStringListener:x:", +); +final _objc_msgSend_po4t03 = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Int32, + ) + > + >() + .asFunction< + void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + int, + ) + >(); +late final _sel_callNoTrampolineListener_ = objc.registerName( + "callNoTrampolineListener:", +); +late final _sel_newBlock_withMult_ = objc.registerName("newBlock:withMult:"); +final _objc_msgSend_jevgay = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Int, + ) + > + >() + .asFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + int, + ) + >(); +late final _sel_newBlockBlock_ = objc.registerName("newBlockBlock:"); +final _objc_msgSend_w43bzz = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ffi.Int, + ) + > + >() + .asFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + int, + ) + >(); +late final _sel_invokeAndReleaseListenerOnNewThread = objc.registerName( + "invokeAndReleaseListenerOnNewThread", +); +late final _sel_invokeAndReleaseListener_ = objc.registerName( + "invokeAndReleaseListener:", +); +late final _sel_blockingBlockTest_resultBlock_ = objc.registerName( + "blockingBlockTest:resultBlock:", +); +final _objc_msgSend_18yul99 = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ) + > + >() + .asFunction< + void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ) + >(); + +/// BlockTester +class BlockTester extends objc.NSObject { + BlockTester._( + ffi.Pointer pointer, { + bool retain = false, + bool release = false, + }) : super.castFromPointer(pointer, retain: retain, release: release); + + /// Constructs a [BlockTester] that points to the same underlying object as [other]. + BlockTester.castFrom(objc.ObjCObjectBase other) + : this._(other.ref.pointer, retain: true, release: true); + + /// Constructs a [BlockTester] that wraps the given raw object pointer. + BlockTester.castFromPointer( + ffi.Pointer other, { + bool retain = false, + bool release = false, + }) : this._(other, retain: retain, release: release); + + /// Returns whether [obj] is an instance of [BlockTester]. + static bool isInstance(objc.ObjCObjectBase obj) { + return _objc_msgSend_19nvye5( + obj.ref.pointer, + _sel_isKindOfClass_, + _class_BlockTester, + ); + } + + /// setup: + static void setup(ffi.Pointer apiData) { + _objc_msgSend_ovsamd(_class_BlockTester, _sel_setup_, apiData); + } + + /// newFromBlock: + static BlockTester newFromBlock(DartIntBlock block) { + final _ret = _objc_msgSend_nnxkei( + _class_BlockTester, + _sel_newFromBlock_, + block.ref.pointer, + ); + return BlockTester.castFromPointer(_ret, retain: false, release: true); + } + + /// newFromMultiplier: + static BlockTester newFromMultiplier(int mult) { + final _ret = _objc_msgSend_aclumu( + _class_BlockTester, + _sel_newFromMultiplier_, + mult, + ); + return BlockTester.castFromPointer(_ret, retain: false, release: true); + } + + /// newFromListener: + static BlockTester newFromListener(DartObjectListenerBlock block) { + final _ret = _objc_msgSend_nnxkei( + _class_BlockTester, + _sel_newFromListener_, + block.ref.pointer, + ); + return BlockTester.castFromPointer(_ret, retain: false, release: true); + } + + /// call: + int call(int x) { + return _objc_msgSend_zo3bvx(this.ref.pointer, _sel_call_, x); + } + + /// getBlock + DartIntBlock getBlock() { + final _ret = _objc_msgSend_uwvaik(this.ref.pointer, _sel_getBlock); + return ObjCBlock_Int32_Int32.castFromPointer( + _ret, + retain: false, + release: true, + ); + } + + /// pokeBlock + void pokeBlock() { + _objc_msgSend_1pl9qdv(this.ref.pointer, _sel_pokeBlock); + } + + /// callOnSameThread: + static void callOnSameThread(DartVoidBlock block) { + _objc_msgSend_f167m6( + _class_BlockTester, + _sel_callOnSameThread_, + block.ref.pointer, + ); + } + + /// callOnSameThreadOutsideIsolate: + static void callOnSameThreadOutsideIsolate(DartVoidBlock block) { + _objc_msgSend_f167m6( + _class_BlockTester, + _sel_callOnSameThreadOutsideIsolate_, + block.ref.pointer, + ); + } + + /// callOnNewThread: + static NSThread callOnNewThread(DartVoidBlock block) { + final _ret = _objc_msgSend_nnxkei( + _class_BlockTester, + _sel_callOnNewThread_, + block.ref.pointer, + ); + return NSThread.castFromPointer(_ret, retain: false, release: true); + } + + /// callWithBlockOnNewThread: + static NSThread callWithBlockOnNewThread(DartListenerBlock block) { + final _ret = _objc_msgSend_nnxkei( + _class_BlockTester, + _sel_callWithBlockOnNewThread_, + block.ref.pointer, + ); + return NSThread.castFromPointer(_ret, retain: false, release: true); + } + + /// callFloatBlock: + static double callFloatBlock(DartFloatBlock block) { + return objc.useMsgSendVariants + ? _objc_msgSend_o8bnmsFpret( + _class_BlockTester, + _sel_callFloatBlock_, + block.ref.pointer, + ) + : _objc_msgSend_o8bnms( + _class_BlockTester, + _sel_callFloatBlock_, + block.ref.pointer, + ); + } + + /// callDoubleBlock: + static double callDoubleBlock(DartDoubleBlock block) { + return objc.useMsgSendVariants + ? _objc_msgSend_8mj2fvFpret( + _class_BlockTester, + _sel_callDoubleBlock_, + block.ref.pointer, + ) + : _objc_msgSend_8mj2fv( + _class_BlockTester, + _sel_callDoubleBlock_, + block.ref.pointer, + ); + } + + /// callVec4Block: + static Vec4 callVec4Block(DartVec4Block block) { + final _ptr = pkg_ffi.calloc(); + objc.useMsgSendVariants + ? _objc_msgSend_1gew1vmStret( + _ptr, + _class_BlockTester, + _sel_callVec4Block_, + block.ref.pointer, + ) + : _ptr.ref = _objc_msgSend_1gew1vm( + _class_BlockTester, + _sel_callVec4Block_, + block.ref.pointer, + ); + final _finalizable = _ptr.cast().asTypedList( + ffi.sizeOf(), + finalizer: pkg_ffi.calloc.nativeFree, + ); + return ffi.Struct.create(_finalizable); + } + + /// callSelectorBlock: + static void callSelectorBlock(DartSelectorBlock block) { + _objc_msgSend_f167m6( + _class_BlockTester, + _sel_callSelectorBlock_, + block.ref.pointer, + ); + } + + /// callObjectBlock: + static DummyObject callObjectBlock(DartObjectBlock block) { + final _ret = _objc_msgSend_nnxkei( + _class_BlockTester, + _sel_callObjectBlock_, + block.ref.pointer, + ); + return DummyObject.castFromPointer(_ret, retain: false, release: true); + } + + /// callNullableObjectBlock: + static DummyObject? callNullableObjectBlock(DartNullableObjectBlock block) { + final _ret = _objc_msgSend_nnxkei( + _class_BlockTester, + _sel_callNullableObjectBlock_, + block.ref.pointer, + ); + return _ret.address == 0 + ? null + : DummyObject.castFromPointer(_ret, retain: false, release: true); + } + + /// callNullableStringBlock: + static objc.NSString? callNullableStringBlock( + objc.ObjCBlock block, + ) { + final _ret = _objc_msgSend_nnxkei( + _class_BlockTester, + _sel_callNullableStringBlock_, + block.ref.pointer, + ); + return _ret.address == 0 + ? null + : objc.NSString.castFromPointer(_ret, retain: false, release: true); + } + + /// callListener: + static void callListener(DartListenerBlock block) { + _objc_msgSend_f167m6( + _class_BlockTester, + _sel_callListener_, + block.ref.pointer, + ); + } + + /// callObjectListener: + static void callObjectListener(DartObjectListenerBlock block) { + _objc_msgSend_f167m6( + _class_BlockTester, + _sel_callObjectListener_, + block.ref.pointer, + ); + } + + /// callNullableListener: + static void callNullableListener(DartNullableListenerBlock block) { + _objc_msgSend_f167m6( + _class_BlockTester, + _sel_callNullableListener_, + block.ref.pointer, + ); + } + + /// callStructListener: + static void callStructListener(DartStructListenerBlock block) { + _objc_msgSend_f167m6( + _class_BlockTester, + _sel_callStructListener_, + block.ref.pointer, + ); + } + + /// callNSStringListener:x: + static void callNSStringListener( + DartNSStringListenerBlock block, { + required int x, + }) { + _objc_msgSend_po4t03( + _class_BlockTester, + _sel_callNSStringListener_x_, + block.ref.pointer, + x, + ); + } + + /// callNoTrampolineListener: + static void callNoTrampolineListener(DartNoTrampolineListenerBlock block) { + _objc_msgSend_f167m6( + _class_BlockTester, + _sel_callNoTrampolineListener_, + block.ref.pointer, + ); + } + + /// newBlock:withMult: + static DartIntBlock newBlock(DartBlockBlock block, {required int withMult}) { + final _ret = _objc_msgSend_jevgay( + _class_BlockTester, + _sel_newBlock_withMult_, + block.ref.pointer, + withMult, + ); + return ObjCBlock_Int32_Int32.castFromPointer( + _ret, + retain: false, + release: true, + ); + } + + /// newBlockBlock: + static DartBlockBlock newBlockBlock(int mult) { + final _ret = _objc_msgSend_w43bzz( + _class_BlockTester, + _sel_newBlockBlock_, + mult, + ); + return ObjCBlock_IntBlock_IntBlock.castFromPointer( + _ret, + retain: false, + release: true, + ); + } + + /// invokeAndReleaseListenerOnNewThread + void invokeAndReleaseListenerOnNewThread() { + _objc_msgSend_1pl9qdv( + this.ref.pointer, + _sel_invokeAndReleaseListenerOnNewThread, + ); + } + + /// invokeAndReleaseListener: + void invokeAndReleaseListener(objc.ObjCObjectBase? _$) { + _objc_msgSend_xtuoz7( + this.ref.pointer, + _sel_invokeAndReleaseListener_, + _$?.ref.pointer ?? ffi.nullptr, + ); + } + + /// blockingBlockTest:resultBlock: + static void blockingBlockTest( + objc.ObjCBlock)> blockingBlock, { + required objc.ObjCBlock resultBlock, + }) { + _objc_msgSend_18yul99( + _class_BlockTester, + _sel_blockingBlockTest_resultBlock_, + blockingBlock.ref.pointer, + resultBlock.ref.pointer, + ); + } + + /// init + BlockTester init() { + objc.checkOsVersionInternal( + 'BlockTester.init', + iOS: (false, (2, 0, 0)), + macOS: (false, (10, 0, 0)), + ); + final _ret = _objc_msgSend_151sglz( + this.ref.retainAndReturnPointer(), + _sel_init, + ); + return BlockTester.castFromPointer(_ret, retain: false, release: true); + } + + /// new + static BlockTester new$() { + final _ret = _objc_msgSend_151sglz(_class_BlockTester, _sel_new); + return BlockTester.castFromPointer(_ret, retain: false, release: true); + } + + /// allocWithZone: + static BlockTester allocWithZone(ffi.Pointer zone) { + final _ret = _objc_msgSend_1cwp428( + _class_BlockTester, + _sel_allocWithZone_, + zone, + ); + return BlockTester.castFromPointer(_ret, retain: false, release: true); + } + + /// alloc + static BlockTester alloc() { + final _ret = _objc_msgSend_151sglz(_class_BlockTester, _sel_alloc); + return BlockTester.castFromPointer(_ret, retain: false, release: true); + } + + /// self + BlockTester self$1() { + final _ret = _objc_msgSend_151sglz(this.ref.pointer, _sel_self); + return BlockTester.castFromPointer(_ret, retain: true, release: true); + } + + /// retain + BlockTester retain() { + final _ret = _objc_msgSend_151sglz(this.ref.pointer, _sel_retain); + return BlockTester.castFromPointer(_ret, retain: true, release: true); + } + + /// autorelease + BlockTester autorelease() { + final _ret = _objc_msgSend_151sglz(this.ref.pointer, _sel_autorelease); + return BlockTester.castFromPointer(_ret, retain: true, release: true); + } + + /// Returns a new instance of BlockTester constructed with the default `new` method. + factory BlockTester() => new$(); +} diff --git a/pkgs/ffigen/test/native_objc_test/block_bindings.m b/pkgs/ffigen/test/native_objc_test/block_bindings.m new file mode 100644 index 000000000..f3b899e60 --- /dev/null +++ b/pkgs/ffigen/test/native_objc_test/block_bindings.m @@ -0,0 +1,179 @@ +#include +#import +#import +#import "block_test.h" + +#if !__has_feature(objc_arc) +#error "This file must be compiled with ARC enabled" +#endif + +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wundeclared-selector" + +typedef struct { + int64_t version; + void* (*newWaiter)(void); + void (*awaitWaiter)(void*); + void* (*currentIsolate)(void); + void (*enterIsolate)(void*); + void (*exitIsolate)(void); + int64_t (*getMainPortId)(void); + bool (*getCurrentThreadOwnsIsolate)(int64_t); +} DOBJC_Context; + +id objc_retainBlock(id); + +#define BLOCKING_BLOCK_IMPL(ctx, BLOCK_SIG, INVOKE_DIRECT, INVOKE_LISTENER) \ + assert(ctx->version >= 1); \ + void* targetIsolate = ctx->currentIsolate(); \ + int64_t targetPort = ctx->getMainPortId == NULL ? 0 : ctx->getMainPortId(); \ + return BLOCK_SIG { \ + void* currentIsolate = ctx->currentIsolate(); \ + bool mayEnterIsolate = \ + currentIsolate == NULL && \ + ctx->getCurrentThreadOwnsIsolate != NULL && \ + ctx->getCurrentThreadOwnsIsolate(targetPort); \ + if (currentIsolate == targetIsolate || mayEnterIsolate) { \ + if (mayEnterIsolate) { \ + ctx->enterIsolate(targetIsolate); \ + } \ + INVOKE_DIRECT; \ + if (mayEnterIsolate) { \ + ctx->exitIsolate(); \ + } \ + } else { \ + void* waiter = ctx->newWaiter(); \ + INVOKE_LISTENER; \ + ctx->awaitWaiter(waiter); \ + } \ + }; + + +typedef void (^ListenerTrampoline)(); +typedef void (^BlockingTrampoline)(void * waiter); +__attribute__((visibility("default"))) __attribute__((used)) +ListenerTrampoline _BlockTestObjCLibrary_wrapBlockingBlock_1pl9qdv( + BlockingTrampoline block, BlockingTrampoline listenerBlock, + DOBJC_Context* ctx) NS_RETURNS_RETAINED { + BLOCKING_BLOCK_IMPL(ctx, ^void(), { + objc_retainBlock(block); + block(nil); + }, { + objc_retainBlock(listenerBlock); + listenerBlock(waiter); + }); +} + +typedef id (^ProtocolTrampoline)(void * sel); +__attribute__((visibility("default"))) __attribute__((used)) +id _BlockTestObjCLibrary_protocolTrampoline_1mbt9g9(id target, void * sel) { + return ((ProtocolTrampoline)((id (*)(id, SEL, SEL))objc_msgSend)(target, @selector(getDOBJCDartProtocolMethodForSelector:), sel))(sel); +} + +typedef void (^ListenerTrampoline_1)(struct objc_selector * arg0); +typedef void (^BlockingTrampoline_1)(void * waiter, struct objc_selector * arg0); +__attribute__((visibility("default"))) __attribute__((used)) +ListenerTrampoline_1 _BlockTestObjCLibrary_wrapBlockingBlock_1d9e4oe( + BlockingTrampoline_1 block, BlockingTrampoline_1 listenerBlock, + DOBJC_Context* ctx) NS_RETURNS_RETAINED { + BLOCKING_BLOCK_IMPL(ctx, ^void(struct objc_selector * arg0), { + objc_retainBlock(block); + block(nil, arg0); + }, { + objc_retainBlock(listenerBlock); + listenerBlock(waiter, arg0); + }); +} + +typedef void (^ListenerTrampoline_2)(id arg0); +typedef void (^BlockingTrampoline_2)(void * waiter, id arg0); +__attribute__((visibility("default"))) __attribute__((used)) +ListenerTrampoline_2 _BlockTestObjCLibrary_wrapBlockingBlock_f167m6( + BlockingTrampoline_2 block, BlockingTrampoline_2 listenerBlock, + DOBJC_Context* ctx) NS_RETURNS_RETAINED { + BLOCKING_BLOCK_IMPL(ctx, ^void(id arg0), { + objc_retainBlock(block); + block(nil, objc_retainBlock(arg0)); + }, { + objc_retainBlock(listenerBlock); + listenerBlock(waiter, objc_retainBlock(arg0)); + }); +} + +typedef void (^ListenerTrampoline_3)(id arg0); +typedef void (^BlockingTrampoline_3)(void * waiter, id arg0); +__attribute__((visibility("default"))) __attribute__((used)) +ListenerTrampoline_3 _BlockTestObjCLibrary_wrapBlockingBlock_xtuoz7( + BlockingTrampoline_3 block, BlockingTrampoline_3 listenerBlock, + DOBJC_Context* ctx) NS_RETURNS_RETAINED { + BLOCKING_BLOCK_IMPL(ctx, ^void(id arg0), { + objc_retainBlock(block); + block(nil, (__bridge id)(__bridge_retained void*)(arg0)); + }, { + objc_retainBlock(listenerBlock); + listenerBlock(waiter, (__bridge id)(__bridge_retained void*)(arg0)); + }); +} + +typedef void (^ListenerTrampoline_4)(struct Vec2 arg0, Vec4 arg1, id arg2); +typedef void (^BlockingTrampoline_4)(void * waiter, struct Vec2 arg0, Vec4 arg1, id arg2); +__attribute__((visibility("default"))) __attribute__((used)) +ListenerTrampoline_4 _BlockTestObjCLibrary_wrapBlockingBlock_ru30ue( + BlockingTrampoline_4 block, BlockingTrampoline_4 listenerBlock, + DOBJC_Context* ctx) NS_RETURNS_RETAINED { + BLOCKING_BLOCK_IMPL(ctx, ^void(struct Vec2 arg0, Vec4 arg1, id arg2), { + objc_retainBlock(block); + block(nil, arg0, arg1, (__bridge id)(__bridge_retained void*)(arg2)); + }, { + objc_retainBlock(listenerBlock); + listenerBlock(waiter, arg0, arg1, (__bridge id)(__bridge_retained void*)(arg2)); + }); +} + +typedef void (^ListenerTrampoline_5)(int32_t arg0, Vec4 arg1, char * arg2); +typedef void (^BlockingTrampoline_5)(void * waiter, int32_t arg0, Vec4 arg1, char * arg2); +__attribute__((visibility("default"))) __attribute__((used)) +ListenerTrampoline_5 _BlockTestObjCLibrary_wrapBlockingBlock_li50va( + BlockingTrampoline_5 block, BlockingTrampoline_5 listenerBlock, + DOBJC_Context* ctx) NS_RETURNS_RETAINED { + BLOCKING_BLOCK_IMPL(ctx, ^void(int32_t arg0, Vec4 arg1, char * arg2), { + objc_retainBlock(block); + block(nil, arg0, arg1, arg2); + }, { + objc_retainBlock(listenerBlock); + listenerBlock(waiter, arg0, arg1, arg2); + }); +} + +typedef void (^ListenerTrampoline_6)(int32_t * arg0); +typedef void (^BlockingTrampoline_6)(void * waiter, int32_t * arg0); +__attribute__((visibility("default"))) __attribute__((used)) +ListenerTrampoline_6 _BlockTestObjCLibrary_wrapBlockingBlock_yhkuco( + BlockingTrampoline_6 block, BlockingTrampoline_6 listenerBlock, + DOBJC_Context* ctx) NS_RETURNS_RETAINED { + BLOCKING_BLOCK_IMPL(ctx, ^void(int32_t * arg0), { + objc_retainBlock(block); + block(nil, arg0); + }, { + objc_retainBlock(listenerBlock); + listenerBlock(waiter, arg0); + }); +} + +typedef void (^ListenerTrampoline_7)(int32_t arg0); +typedef void (^BlockingTrampoline_7)(void * waiter, int32_t arg0); +__attribute__((visibility("default"))) __attribute__((used)) +ListenerTrampoline_7 _BlockTestObjCLibrary_wrapBlockingBlock_1bqef4y( + BlockingTrampoline_7 block, BlockingTrampoline_7 listenerBlock, + DOBJC_Context* ctx) NS_RETURNS_RETAINED { + BLOCKING_BLOCK_IMPL(ctx, ^void(int32_t arg0), { + objc_retainBlock(block); + block(nil, arg0); + }, { + objc_retainBlock(listenerBlock); + listenerBlock(waiter, arg0); + }); +} +#undef BLOCKING_BLOCK_IMPL + +#pragma clang diagnostic pop diff --git a/pkgs/ffigen/test/native_objc_test/block_inherit_test.dart b/pkgs/ffigen/test/native_objc_test/block_inherit_test.dart index abda74ddb..1c60769ca 100644 --- a/pkgs/ffigen/test/native_objc_test/block_inherit_test.dart +++ b/pkgs/ffigen/test/native_objc_test/block_inherit_test.dart @@ -21,16 +21,6 @@ import 'util.dart'; void main() { group('Block inheritance', () { setUpAll(() { - // TODO(https://github.com/dart-lang/native/issues/1068): Remove this. - DynamicLibrary.open( - path.join( - packagePathForTests, - '..', - 'objective_c', - 'test', - 'objective_c.dylib', - ), - ); final dylib = File( path.join( packagePathForTests, diff --git a/pkgs/ffigen/test/native_objc_test/block_test.dart b/pkgs/ffigen/test/native_objc_test/block_test.dart index 12910ca55..57f5a084b 100644 --- a/pkgs/ffigen/test/native_objc_test/block_test.dart +++ b/pkgs/ffigen/test/native_objc_test/block_test.dart @@ -12,7 +12,7 @@ import 'dart:io'; import 'dart:isolate'; import 'package:ffi/ffi.dart'; -import 'package:objective_c/objective_c.dart'; +import 'package:objective_c/objective_c.dart' hide ObjCBlock_ffiVoid, ObjCBlock_ffiVoid_CallExtension; import 'package:objective_c/src/internal.dart' as internal_for_testing show blockHasRegisteredClosure; @@ -54,16 +54,6 @@ void main() { group('Blocks', () { setUpAll(() { - // TODO(https://github.com/dart-lang/native/issues/1068): Remove this. - DynamicLibrary.open( - path.join( - packagePathForTests, - '..', - 'objective_c', - 'test', - 'objective_c.dylib', - ), - ); final dylib = File( path.join( packagePathForTests, @@ -75,12 +65,12 @@ void main() { verifySetupFile(dylib); lib = BlockTestObjCLibrary(DynamicLibrary.open(dylib.absolute.path)); - generateBindingsForCoverage('block'); + // generateBindingsForCoverage('block'); BlockTester.setup(NativeApi.initializeApiDLData); }); - test('BlockTester is working', () { + /*test('BlockTester is working', () { // This doesn't test any Block functionality, just that the BlockTester // itself is working correctly. final blockTester = BlockTester.newFromMultiplier(10); @@ -111,7 +101,7 @@ void main() { blockTester.pokeBlock(); expect(blockTester.call(123), 4123); expect(block(123), 4123); - }); + });*/ test('Listener block same thread', () async { final hasRun = Completer(); @@ -125,9 +115,10 @@ void main() { await hasRun.future; expect(value, 123); + print('test done: $value'); }); - test('Listener block new thread', () async { + /*test('Listener block new thread', () async { final hasRun = Completer(); int value = 0; final block = VoidBlock.listener(() { @@ -158,9 +149,9 @@ void main() { }); BlockTester.callOnSameThread(block); expect(value, 123); - }); + });*/ - test('Blocking block new thread', () async { + /*test('Blocking block new thread', () async { final block = IntPtrBlock.blocking((Pointer result) { waitSync(Duration(milliseconds: 100)); result.value = 123456; @@ -204,9 +195,9 @@ void main() { }); block(); expect(value, 123); - }); + });*/ - test('Float block', () { + /*test('Float block', () { final block = FloatBlock.fromFunction((double x) { return x + 4.56; }); @@ -325,9 +316,9 @@ void main() { final result3 = BlockTester.callNullableStringBlock(block); expect(result3?.toDartString(), 'Lizard Cat'); - }); + });*/ - test('Object listener block', () async { + /*test('Object listener block', () async { final hasRun = Completer(); final block = ObjectListenerBlock.listener((DummyObject x) { expect(x, isNotNull); @@ -1195,7 +1186,7 @@ void main() { return innerValue; }); expect(value, 123); - }, skip: !hasIsolateOwnershipApi); + }, skip: !hasIsolateOwnershipApi);*/ }); } diff --git a/pkgs/ffigen/test/native_objc_test/cast_test.dart b/pkgs/ffigen/test/native_objc_test/cast_test.dart index 8d5eb1b29..7ab4c8dbf 100644 --- a/pkgs/ffigen/test/native_objc_test/cast_test.dart +++ b/pkgs/ffigen/test/native_objc_test/cast_test.dart @@ -20,16 +20,6 @@ void main() { group('cast', () { setUpAll(() { - // TODO(https://github.com/dart-lang/native/issues/1068): Remove this. - DynamicLibrary.open( - path.join( - packagePathForTests, - '..', - 'objective_c', - 'test', - 'objective_c.dylib', - ), - ); final dylib = File( path.join( packagePathForTests, diff --git a/pkgs/ffigen/test/native_objc_test/category_test.dart b/pkgs/ffigen/test/native_objc_test/category_test.dart index c69406057..d044c7ad6 100644 --- a/pkgs/ffigen/test/native_objc_test/category_test.dart +++ b/pkgs/ffigen/test/native_objc_test/category_test.dart @@ -18,16 +18,6 @@ import 'util.dart'; void main() { group('categories', () { setUpAll(() { - // TODO(https://github.com/dart-lang/native/issues/1068): Remove this. - DynamicLibrary.open( - path.join( - packagePathForTests, - '..', - 'objective_c', - 'test', - 'objective_c.dylib', - ), - ); final dylib = File( path.join( packagePathForTests, diff --git a/pkgs/ffigen/test/native_objc_test/forward_decl_test.dart b/pkgs/ffigen/test/native_objc_test/forward_decl_test.dart index 6557b058c..0d7324689 100644 --- a/pkgs/ffigen/test/native_objc_test/forward_decl_test.dart +++ b/pkgs/ffigen/test/native_objc_test/forward_decl_test.dart @@ -16,16 +16,6 @@ import 'util.dart'; void main() { group('forward decl', () { setUpAll(() { - // TODO(https://github.com/dart-lang/native/issues/1068): Remove this. - DynamicLibrary.open( - path.join( - packagePathForTests, - '..', - 'objective_c', - 'test', - 'objective_c.dylib', - ), - ); final dylib = File( path.join( packagePathForTests, diff --git a/pkgs/ffigen/test/native_objc_test/global_native_test.dart b/pkgs/ffigen/test/native_objc_test/global_native_test.dart index 0cb2727fd..32e4803a0 100644 --- a/pkgs/ffigen/test/native_objc_test/global_native_test.dart +++ b/pkgs/ffigen/test/native_objc_test/global_native_test.dart @@ -18,16 +18,6 @@ import 'util.dart'; void main() { group('global using @Native', () { setUpAll(() { - // TODO(https://github.com/dart-lang/native/issues/1068): Remove this. - DynamicLibrary.open( - path.join( - packagePathForTests, - '..', - 'objective_c', - 'test', - 'objective_c.dylib', - ), - ); final dylib = File( path.join( packagePathForTests, diff --git a/pkgs/ffigen/test/native_objc_test/global_test.dart b/pkgs/ffigen/test/native_objc_test/global_test.dart index 89a5ffebb..e8aaee53f 100644 --- a/pkgs/ffigen/test/native_objc_test/global_test.dart +++ b/pkgs/ffigen/test/native_objc_test/global_test.dart @@ -20,16 +20,6 @@ void main() { late GlobalTestObjCLibrary lib; setUpAll(() { - // TODO(https://github.com/dart-lang/native/issues/1068): Remove this. - DynamicLibrary.open( - path.join( - packagePathForTests, - '..', - 'objective_c', - 'test', - 'objective_c.dylib', - ), - ); final dylib = File( path.join( packagePathForTests, diff --git a/pkgs/ffigen/test/native_objc_test/inherited_instancetype_test.dart b/pkgs/ffigen/test/native_objc_test/inherited_instancetype_test.dart index 0c3a8b47d..b3cb3903f 100644 --- a/pkgs/ffigen/test/native_objc_test/inherited_instancetype_test.dart +++ b/pkgs/ffigen/test/native_objc_test/inherited_instancetype_test.dart @@ -17,16 +17,6 @@ import 'util.dart'; void main() { group('inheritedInstancetype', () { setUpAll(() { - // TODO(https://github.com/dart-lang/native/issues/1068): Remove this. - DynamicLibrary.open( - path.join( - packagePathForTests, - '..', - 'objective_c', - 'test', - 'objective_c.dylib', - ), - ); final dylib = File( path.join( packagePathForTests, diff --git a/pkgs/ffigen/test/native_objc_test/is_instance_test.dart b/pkgs/ffigen/test/native_objc_test/is_instance_test.dart index 2a90aeded..29251357a 100644 --- a/pkgs/ffigen/test/native_objc_test/is_instance_test.dart +++ b/pkgs/ffigen/test/native_objc_test/is_instance_test.dart @@ -18,16 +18,6 @@ import 'util.dart'; void main() { group('isInstance', () { setUpAll(() { - // TODO(https://github.com/dart-lang/native/issues/1068): Remove this. - DynamicLibrary.open( - path.join( - packagePathForTests, - '..', - 'objective_c', - 'test', - 'objective_c.dylib', - ), - ); final dylib = File( path.join( packagePathForTests, diff --git a/pkgs/ffigen/test/native_objc_test/isolate_test.dart b/pkgs/ffigen/test/native_objc_test/isolate_test.dart index 1ebdb4f9c..4fd7ebf0e 100644 --- a/pkgs/ffigen/test/native_objc_test/isolate_test.dart +++ b/pkgs/ffigen/test/native_objc_test/isolate_test.dart @@ -20,16 +20,6 @@ import 'util.dart'; void main() { group('isolate', () { setUpAll(() { - // TODO(https://github.com/dart-lang/native/issues/1068): Remove this. - DynamicLibrary.open( - path.join( - packagePathForTests, - '..', - 'objective_c', - 'test', - 'objective_c.dylib', - ), - ); final dylib = File( path.join( packagePathForTests, diff --git a/pkgs/ffigen/test/native_objc_test/log_test.dart b/pkgs/ffigen/test/native_objc_test/log_test.dart index 94f1a2ac9..cb734292e 100644 --- a/pkgs/ffigen/test/native_objc_test/log_test.dart +++ b/pkgs/ffigen/test/native_objc_test/log_test.dart @@ -18,16 +18,6 @@ import 'util.dart'; void main() { group('log_test', () { setUpAll(() { - // TODO(https://github.com/dart-lang/native/issues/1068): Remove this. - DynamicLibrary.open( - path.join( - packagePathForTests, - '..', - 'objective_c', - 'test', - 'objective_c.dylib', - ), - ); final dylib = File( path.join( packagePathForTests, diff --git a/pkgs/ffigen/test/native_objc_test/method_filtering_test.dart b/pkgs/ffigen/test/native_objc_test/method_filtering_test.dart index 94c66b654..7ddd0a286 100644 --- a/pkgs/ffigen/test/native_objc_test/method_filtering_test.dart +++ b/pkgs/ffigen/test/native_objc_test/method_filtering_test.dart @@ -24,7 +24,6 @@ void main() { group('no version info', () { late final String bindings; setUpAll(() { - // TODO(https://github.com/dart-lang/native/issues/1068): Remove this. generateBindingsForCoverage('method_filtering'); bindings = File( path.join( diff --git a/pkgs/ffigen/test/native_objc_test/method_test.dart b/pkgs/ffigen/test/native_objc_test/method_test.dart index de03b95b2..03d6da67c 100644 --- a/pkgs/ffigen/test/native_objc_test/method_test.dart +++ b/pkgs/ffigen/test/native_objc_test/method_test.dart @@ -19,16 +19,6 @@ void main() { group('method calls', () { setUpAll(() { - // TODO(https://github.com/dart-lang/native/issues/1068): Remove this. - DynamicLibrary.open( - path.join( - packagePathForTests, - '..', - 'objective_c', - 'test', - 'objective_c.dylib', - ), - ); final dylib = File( path.join( packagePathForTests, diff --git a/pkgs/ffigen/test/native_objc_test/native_objc_test.dart b/pkgs/ffigen/test/native_objc_test/native_objc_test.dart index 9c5209137..3b88eaecd 100644 --- a/pkgs/ffigen/test/native_objc_test/native_objc_test.dart +++ b/pkgs/ffigen/test/native_objc_test/native_objc_test.dart @@ -17,16 +17,6 @@ import 'util.dart'; void main() { group('native_objc_test', () { setUpAll(() { - // TODO(https://github.com/dart-lang/native/issues/1068): Remove this. - DynamicLibrary.open( - path.join( - packagePathForTests, - '..', - 'objective_c', - 'test', - 'objective_c.dylib', - ), - ); final dylib = File( path.join( packagePathForTests, diff --git a/pkgs/ffigen/test/native_objc_test/nullable_inheritance_test.dart b/pkgs/ffigen/test/native_objc_test/nullable_inheritance_test.dart index 98112a987..18b95fe5e 100644 --- a/pkgs/ffigen/test/native_objc_test/nullable_inheritance_test.dart +++ b/pkgs/ffigen/test/native_objc_test/nullable_inheritance_test.dart @@ -21,16 +21,6 @@ void main() { late NSObject obj; group('Nullable inheritance', () { setUpAll(() { - // TODO(https://github.com/dart-lang/native/issues/1068): Remove this. - DynamicLibrary.open( - path.join( - packagePathForTests, - '..', - 'objective_c', - 'test', - 'objective_c.dylib', - ), - ); final dylib = File( path.join( packagePathForTests, diff --git a/pkgs/ffigen/test/native_objc_test/nullable_test.dart b/pkgs/ffigen/test/native_objc_test/nullable_test.dart index 76b220a2a..5c8051878 100644 --- a/pkgs/ffigen/test/native_objc_test/nullable_test.dart +++ b/pkgs/ffigen/test/native_objc_test/nullable_test.dart @@ -20,16 +20,6 @@ void main() { late NSObject obj; group('Nullability', () { setUpAll(() { - // TODO(https://github.com/dart-lang/native/issues/1068): Remove this. - DynamicLibrary.open( - path.join( - packagePathForTests, - '..', - 'objective_c', - 'test', - 'objective_c.dylib', - ), - ); final dylib = File( path.join( packagePathForTests, diff --git a/pkgs/ffigen/test/native_objc_test/property_test.dart b/pkgs/ffigen/test/native_objc_test/property_test.dart index 46d7b2c39..dd5f3966a 100644 --- a/pkgs/ffigen/test/native_objc_test/property_test.dart +++ b/pkgs/ffigen/test/native_objc_test/property_test.dart @@ -20,16 +20,6 @@ void main() { group('properties', () { setUpAll(() { - // TODO(https://github.com/dart-lang/native/issues/1068): Remove this. - DynamicLibrary.open( - path.join( - packagePathForTests, - '..', - 'objective_c', - 'test', - 'objective_c.dylib', - ), - ); final dylib = File( path.join( packagePathForTests, diff --git a/pkgs/ffigen/test/native_objc_test/protocol_test.dart b/pkgs/ffigen/test/native_objc_test/protocol_test.dart index 4d84b7cfd..8b81683fa 100644 --- a/pkgs/ffigen/test/native_objc_test/protocol_test.dart +++ b/pkgs/ffigen/test/native_objc_test/protocol_test.dart @@ -29,16 +29,6 @@ void main() { group('protocol', () { setUpAll(() { - // TODO(https://github.com/dart-lang/native/issues/1068): Remove this. - DynamicLibrary.open( - path.join( - packagePathForTests, - '..', - 'objective_c', - 'test', - 'objective_c.dylib', - ), - ); final dylib = File( path.join( packagePathForTests, diff --git a/pkgs/ffigen/test/native_objc_test/ref_count_test.dart b/pkgs/ffigen/test/native_objc_test/ref_count_test.dart index 122bbb626..c41084e34 100644 --- a/pkgs/ffigen/test/native_objc_test/ref_count_test.dart +++ b/pkgs/ffigen/test/native_objc_test/ref_count_test.dart @@ -22,16 +22,6 @@ void main() { group('Reference counting', () { setUpAll(() { - // TODO(https://github.com/dart-lang/native/issues/1068): Remove this. - DynamicLibrary.open( - path.join( - packagePathForTests, - '..', - 'objective_c', - 'test', - 'objective_c.dylib', - ), - ); final dylib = File( path.join( packagePathForTests, diff --git a/pkgs/ffigen/test/native_objc_test/rename_test.dart b/pkgs/ffigen/test/native_objc_test/rename_test.dart index f93217b2c..b017699f3 100644 --- a/pkgs/ffigen/test/native_objc_test/rename_test.dart +++ b/pkgs/ffigen/test/native_objc_test/rename_test.dart @@ -17,16 +17,6 @@ import 'util.dart'; void main() { group('rename_test', () { setUpAll(() { - // TODO(https://github.com/dart-lang/native/issues/1068): Remove this. - DynamicLibrary.open( - path.join( - packagePathForTests, - '..', - 'objective_c', - 'test', - 'objective_c.dylib', - ), - ); final dylib = File( path.join( packagePathForTests, diff --git a/pkgs/ffigen/test/native_objc_test/runtime_version_test.dart b/pkgs/ffigen/test/native_objc_test/runtime_version_test.dart index 5fe3a4052..c0faf1f62 100644 --- a/pkgs/ffigen/test/native_objc_test/runtime_version_test.dart +++ b/pkgs/ffigen/test/native_objc_test/runtime_version_test.dart @@ -18,16 +18,6 @@ import 'util.dart'; void main() { group('runtime version check', () { setUpAll(() { - // TODO(https://github.com/dart-lang/native/issues/1068): Remove this. - DynamicLibrary.open( - path.join( - packagePathForTests, - '..', - 'objective_c', - 'test', - 'objective_c.dylib', - ), - ); final dylib = File( path.join( packagePathForTests, diff --git a/pkgs/ffigen/test/native_objc_test/sdk_variable_test.dart b/pkgs/ffigen/test/native_objc_test/sdk_variable_test.dart index d4344a68a..b0fb85ddb 100644 --- a/pkgs/ffigen/test/native_objc_test/sdk_variable_test.dart +++ b/pkgs/ffigen/test/native_objc_test/sdk_variable_test.dart @@ -17,16 +17,6 @@ void main() { late String bindings; setUpAll(() { - // TODO(https://github.com/dart-lang/native/issues/1068): Remove this. - DynamicLibrary.open( - path.join( - packagePathForTests, - '..', - 'objective_c', - 'test', - 'objective_c.dylib', - ), - ); final dylib = File( path.join( packagePathForTests, diff --git a/pkgs/ffigen/test/native_objc_test/setup.dart b/pkgs/ffigen/test/native_objc_test/setup.dart index c02c47602..e9ffd84bd 100644 --- a/pkgs/ffigen/test/native_objc_test/setup.dart +++ b/pkgs/ffigen/test/native_objc_test/setup.dart @@ -125,10 +125,10 @@ Future build(List testNames) async { // Ffigen comes next because it may generate an ObjC file that is compiled // into the dylib. - print('Generating Bindings for Objective C Native Tests...'); - for (final name in testNames) { - await _generateBindings('${name}_config.yaml'); - } + // print('Generating Bindings for Objective C Native Tests...'); + // for (final name in testNames) { + // await _generateBindings('${name}_config.yaml'); + // } // Finally we build the dylib containing all the ObjC test code. print('Building Dynamic Library for Objective C Native Tests...'); @@ -165,7 +165,6 @@ Future clean(List testNames) async { Future main(List arguments) async { final parser = ArgParser(); parser.addFlag('clean'); - parser.addFlag('main-thread-dispatcher'); final args = parser.parse(arguments); // Allow running this script directly from any path (or an IDE). @@ -178,9 +177,5 @@ Future main(List arguments) async { return await clean(_getTestNames()); } - await _runDart([ - '../objective_c/test/setup.dart', - if (args.flag('main-thread-dispatcher')) '--main-thread-dispatcher', - ]); return await build(args.rest.isNotEmpty ? args.rest : _getTestNames()); } diff --git a/pkgs/ffigen/test/native_objc_test/static_func_test.dart b/pkgs/ffigen/test/native_objc_test/static_func_test.dart index 9638f62e2..a80b30dd8 100644 --- a/pkgs/ffigen/test/native_objc_test/static_func_test.dart +++ b/pkgs/ffigen/test/native_objc_test/static_func_test.dart @@ -27,16 +27,6 @@ void main() { group('static functions', () { setUpAll(() { - // TODO(https://github.com/dart-lang/native/issues/1068): Remove this. - DynamicLibrary.open( - path.join( - packagePathForTests, - '..', - 'objective_c', - 'test', - 'objective_c.dylib', - ), - ); final dylib = File( path.join( packagePathForTests, diff --git a/pkgs/ffigen/test/native_objc_test/string_test.dart b/pkgs/ffigen/test/native_objc_test/string_test.dart index c46d9cd21..dc7905700 100644 --- a/pkgs/ffigen/test/native_objc_test/string_test.dart +++ b/pkgs/ffigen/test/native_objc_test/string_test.dart @@ -18,16 +18,6 @@ import 'util.dart'; void main() { group('string', () { setUpAll(() { - // TODO(https://github.com/dart-lang/native/issues/1068): Remove this. - DynamicLibrary.open( - path.join( - packagePathForTests, - '..', - 'objective_c', - 'test', - 'objective_c.dylib', - ), - ); final dylib = File( path.join( packagePathForTests, diff --git a/pkgs/ffigen/test/native_objc_test/swift_class_test.dart b/pkgs/ffigen/test/native_objc_test/swift_class_test.dart index 964e9e1ba..5b4cf28f0 100644 --- a/pkgs/ffigen/test/native_objc_test/swift_class_test.dart +++ b/pkgs/ffigen/test/native_objc_test/swift_class_test.dart @@ -16,16 +16,6 @@ import 'util.dart'; void main() { group('swift_class_test', () { setUpAll(() { - // TODO(https://github.com/dart-lang/native/issues/1068): Remove this. - DynamicLibrary.open( - path.join( - packagePathForTests, - '..', - 'objective_c', - 'test', - 'objective_c.dylib', - ), - ); final dylib = File( path.join( packagePathForTests, diff --git a/pkgs/ffigen/test/native_objc_test/typedef_test.dart b/pkgs/ffigen/test/native_objc_test/typedef_test.dart index 0ee339214..179ccdf20 100644 --- a/pkgs/ffigen/test/native_objc_test/typedef_test.dart +++ b/pkgs/ffigen/test/native_objc_test/typedef_test.dart @@ -16,16 +16,6 @@ import 'util.dart'; void main() { group('typedef', () { setUpAll(() { - // TODO(https://github.com/dart-lang/native/issues/1068): Remove this. - DynamicLibrary.open( - path.join( - packagePathForTests, - '..', - 'objective_c', - 'test', - 'objective_c.dylib', - ), - ); final dylib = File( path.join( packagePathForTests, diff --git a/pkgs/ffigen/test/setup.dart b/pkgs/ffigen/test/setup.dart index 56d99bc6d..6c05b2566 100644 --- a/pkgs/ffigen/test/setup.dart +++ b/pkgs/ffigen/test/setup.dart @@ -8,8 +8,6 @@ import 'dart:async'; import 'dart:io'; -import 'package:args/args.dart'; - Future _run(String subdir, String script, List flags) async { final dir = Platform.script.resolve('$subdir/'); print('\nRunning $script in ${dir.toFilePath()}'); @@ -28,15 +26,9 @@ Future _run(String subdir, String script, List flags) async { } Future main(List arguments) async { - final parser = ArgParser(); - parser.addFlag('main-thread-dispatcher'); - final args = parser.parse(arguments); - await _run('native_test', 'build_test_dylib.dart', []); if (Platform.isMacOS) { - await _run('native_objc_test', 'setup.dart', [ - if (args.flag('main-thread-dispatcher')) '--main-thread-dispatcher', - ]); + await _run('native_objc_test', 'setup.dart', []); } print('\nSuccess :)\n'); } diff --git a/pkgs/objective_c/.metadata b/pkgs/objective_c/.metadata deleted file mode 100644 index a41ab896b..000000000 --- a/pkgs/objective_c/.metadata +++ /dev/null @@ -1,33 +0,0 @@ -# This file tracks properties of this Flutter project. -# Used by Flutter tool to assess capabilities and perform upgrades etc. -# -# This file should be version controlled and should not be manually edited. - -version: - revision: "aedce673f760bc19f13aa0600e2c1df9ae502117" - channel: "master" - -project_type: plugin_ffi - -# Tracks metadata for the flutter migrate command -migration: - platforms: - - platform: root - create_revision: aedce673f760bc19f13aa0600e2c1df9ae502117 - base_revision: aedce673f760bc19f13aa0600e2c1df9ae502117 - - platform: ios - create_revision: aedce673f760bc19f13aa0600e2c1df9ae502117 - base_revision: aedce673f760bc19f13aa0600e2c1df9ae502117 - - platform: macos - create_revision: aedce673f760bc19f13aa0600e2c1df9ae502117 - base_revision: aedce673f760bc19f13aa0600e2c1df9ae502117 - - # User provided section - - # List of Local paths (relative to this file) that should be - # ignored by the migrate tool. - # - # Files that are not part of the templates will be ignored by default. - unmanaged_files: - - 'lib/main.dart' - - 'ios/Runner.xcodeproj/project.pbxproj' diff --git a/pkgs/objective_c/example/.gitignore b/pkgs/objective_c/example/.gitignore new file mode 100644 index 000000000..3a8579040 --- /dev/null +++ b/pkgs/objective_c/example/.gitignore @@ -0,0 +1,3 @@ +# https://dart.dev/guides/libraries/private-files +# Created by `dart pub` +.dart_tool/ diff --git a/pkgs/objective_c/example/CHANGELOG.md b/pkgs/objective_c/example/CHANGELOG.md new file mode 100644 index 000000000..effe43c82 --- /dev/null +++ b/pkgs/objective_c/example/CHANGELOG.md @@ -0,0 +1,3 @@ +## 1.0.0 + +- Initial version. diff --git a/pkgs/objective_c/example/README.md b/pkgs/objective_c/example/README.md index ef2deb7f6..9d9d2e46e 100644 --- a/pkgs/objective_c/example/README.md +++ b/pkgs/objective_c/example/README.md @@ -1,5 +1 @@ -# objective_c example - -Demonstrates how to use the objective_c plugin. - -TODO(https://github.com/dart-lang/native/issues/1068): Migrate to native assets. +Demonstrates using package:objective_c: `dart run lib/main.dart` diff --git a/pkgs/objective_c/example/analysis_options.yaml b/pkgs/objective_c/example/analysis_options.yaml index 22c406e13..572dd239d 100644 --- a/pkgs/objective_c/example/analysis_options.yaml +++ b/pkgs/objective_c/example/analysis_options.yaml @@ -1,6 +1 @@ -include: package:flutter_lints/flutter.yaml - -analyzer: - language: - strict-casts: true - strict-inference: true +include: package:lints/recommended.yaml diff --git a/pkgs/objective_c/example/ios/Flutter/AppFrameworkInfo.plist b/pkgs/objective_c/example/ios/Flutter/AppFrameworkInfo.plist deleted file mode 100644 index 7c5696400..000000000 --- a/pkgs/objective_c/example/ios/Flutter/AppFrameworkInfo.plist +++ /dev/null @@ -1,26 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleExecutable - App - CFBundleIdentifier - io.flutter.flutter.app - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - App - CFBundlePackageType - FMWK - CFBundleShortVersionString - 1.0 - CFBundleSignature - ???? - CFBundleVersion - 1.0 - MinimumOSVersion - 12.0 - - diff --git a/pkgs/objective_c/example/ios/Flutter/Debug.xcconfig b/pkgs/objective_c/example/ios/Flutter/Debug.xcconfig deleted file mode 100644 index ec97fc6f3..000000000 --- a/pkgs/objective_c/example/ios/Flutter/Debug.xcconfig +++ /dev/null @@ -1,2 +0,0 @@ -#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" -#include "Generated.xcconfig" diff --git a/pkgs/objective_c/example/ios/Flutter/Release.xcconfig b/pkgs/objective_c/example/ios/Flutter/Release.xcconfig deleted file mode 100644 index c4855bfe2..000000000 --- a/pkgs/objective_c/example/ios/Flutter/Release.xcconfig +++ /dev/null @@ -1,2 +0,0 @@ -#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" -#include "Generated.xcconfig" diff --git a/pkgs/objective_c/example/ios/Podfile b/pkgs/objective_c/example/ios/Podfile deleted file mode 100644 index d97f17e22..000000000 --- a/pkgs/objective_c/example/ios/Podfile +++ /dev/null @@ -1,44 +0,0 @@ -# Uncomment this line to define a global platform for your project -# platform :ios, '12.0' - -# CocoaPods analytics sends network stats synchronously affecting flutter build latency. -ENV['COCOAPODS_DISABLE_STATS'] = 'true' - -project 'Runner', { - 'Debug' => :debug, - 'Profile' => :release, - 'Release' => :release, -} - -def flutter_root - generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__) - unless File.exist?(generated_xcode_build_settings_path) - raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first" - end - - File.foreach(generated_xcode_build_settings_path) do |line| - matches = line.match(/FLUTTER_ROOT\=(.*)/) - return matches[1].strip if matches - end - raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get" -end - -require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) - -flutter_ios_podfile_setup - -target 'Runner' do - use_frameworks! - use_modular_headers! - - flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__)) - target 'RunnerTests' do - inherit! :search_paths - end -end - -post_install do |installer| - installer.pods_project.targets.each do |target| - flutter_additional_ios_build_settings(target) - end -end diff --git a/pkgs/objective_c/example/ios/Runner.xcodeproj/project.pbxproj b/pkgs/objective_c/example/ios/Runner.xcodeproj/project.pbxproj deleted file mode 100644 index 8f49bdf9e..000000000 --- a/pkgs/objective_c/example/ios/Runner.xcodeproj/project.pbxproj +++ /dev/null @@ -1,728 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 54; - objects = { - -/* Begin PBXBuildFile section */ - 0016C0D0D056FCD78A6A33E8 /* Pods_RunnerTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5349C2B3D454EF3220FB3306 /* Pods_RunnerTests.framework */; }; - 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; - 331C808B294A63AB00263BE5 /* RunnerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 331C807B294A618700263BE5 /* RunnerTests.swift */; }; - 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; - 4D7C7CB911925A31801A2F1E /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0B910B6B0374F2338E70D6AC /* Pods_Runner.framework */; }; - 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; - 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; - 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; - 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; -/* End PBXBuildFile section */ - -/* Begin PBXContainerItemProxy section */ - 331C8085294A63A400263BE5 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 97C146E61CF9000F007C117D /* Project object */; - proxyType = 1; - remoteGlobalIDString = 97C146ED1CF9000F007C117D; - remoteInfo = Runner; - }; -/* End PBXContainerItemProxy section */ - -/* Begin PBXCopyFilesBuildPhase section */ - 9705A1C41CF9048500538489 /* Embed Frameworks */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = ""; - dstSubfolderSpec = 10; - files = ( - ); - name = "Embed Frameworks"; - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXCopyFilesBuildPhase section */ - -/* Begin PBXFileReference section */ - 0B910B6B0374F2338E70D6AC /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; - 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; - 331C807B294A618700263BE5 /* RunnerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RunnerTests.swift; sourceTree = ""; }; - 331C8081294A63A400263BE5 /* RunnerTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RunnerTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; - 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; - 5349C2B3D454EF3220FB3306 /* Pods_RunnerTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_RunnerTests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - 5898EAFA36C90FEB069D15C8 /* Pods-RunnerTests.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.profile.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.profile.xcconfig"; sourceTree = ""; }; - 5E623BDE574BD3F02055F373 /* Pods-RunnerTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.debug.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.debug.xcconfig"; sourceTree = ""; }; - 6F2BCFFFCABF2D8A79F17D26 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; - 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; - 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; - 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; - 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; - 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; - 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; - 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; - 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; - 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; - 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - B6F1E5A6A7CC24D81665E0BA /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; }; - F794A460162AE19694C18D43 /* Pods-RunnerTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.release.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.release.xcconfig"; sourceTree = ""; }; - FFB0D24362152330E942673E /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 97C146EB1CF9000F007C117D /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 4D7C7CB911925A31801A2F1E /* Pods_Runner.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - B209388E6951AC88C18EE569 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 0016C0D0D056FCD78A6A33E8 /* Pods_RunnerTests.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 2961EE994295B641DF59D533 /* Frameworks */ = { - isa = PBXGroup; - children = ( - 0B910B6B0374F2338E70D6AC /* Pods_Runner.framework */, - 5349C2B3D454EF3220FB3306 /* Pods_RunnerTests.framework */, - ); - name = Frameworks; - sourceTree = ""; - }; - 331C8082294A63A400263BE5 /* RunnerTests */ = { - isa = PBXGroup; - children = ( - 331C807B294A618700263BE5 /* RunnerTests.swift */, - ); - path = RunnerTests; - sourceTree = ""; - }; - 9740EEB11CF90186004384FC /* Flutter */ = { - isa = PBXGroup; - children = ( - 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, - 9740EEB21CF90195004384FC /* Debug.xcconfig */, - 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, - 9740EEB31CF90195004384FC /* Generated.xcconfig */, - ); - name = Flutter; - sourceTree = ""; - }; - 97C146E51CF9000F007C117D = { - isa = PBXGroup; - children = ( - 9740EEB11CF90186004384FC /* Flutter */, - 97C146F01CF9000F007C117D /* Runner */, - 97C146EF1CF9000F007C117D /* Products */, - 331C8082294A63A400263BE5 /* RunnerTests */, - 97F4D88CC18AF014179906AC /* Pods */, - 2961EE994295B641DF59D533 /* Frameworks */, - ); - sourceTree = ""; - }; - 97C146EF1CF9000F007C117D /* Products */ = { - isa = PBXGroup; - children = ( - 97C146EE1CF9000F007C117D /* Runner.app */, - 331C8081294A63A400263BE5 /* RunnerTests.xctest */, - ); - name = Products; - sourceTree = ""; - }; - 97C146F01CF9000F007C117D /* Runner */ = { - isa = PBXGroup; - children = ( - 97C146FA1CF9000F007C117D /* Main.storyboard */, - 97C146FD1CF9000F007C117D /* Assets.xcassets */, - 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, - 97C147021CF9000F007C117D /* Info.plist */, - 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */, - 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, - 74858FAE1ED2DC5600515810 /* AppDelegate.swift */, - 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */, - ); - path = Runner; - sourceTree = ""; - }; - 97F4D88CC18AF014179906AC /* Pods */ = { - isa = PBXGroup; - children = ( - FFB0D24362152330E942673E /* Pods-Runner.debug.xcconfig */, - 6F2BCFFFCABF2D8A79F17D26 /* Pods-Runner.release.xcconfig */, - B6F1E5A6A7CC24D81665E0BA /* Pods-Runner.profile.xcconfig */, - 5E623BDE574BD3F02055F373 /* Pods-RunnerTests.debug.xcconfig */, - F794A460162AE19694C18D43 /* Pods-RunnerTests.release.xcconfig */, - 5898EAFA36C90FEB069D15C8 /* Pods-RunnerTests.profile.xcconfig */, - ); - name = Pods; - path = Pods; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXNativeTarget section */ - 331C8080294A63A400263BE5 /* RunnerTests */ = { - isa = PBXNativeTarget; - buildConfigurationList = 331C8087294A63A400263BE5 /* Build configuration list for PBXNativeTarget "RunnerTests" */; - buildPhases = ( - 11218719EF64897AFE1F9EE8 /* [CP] Check Pods Manifest.lock */, - 331C807D294A63A400263BE5 /* Sources */, - 331C807F294A63A400263BE5 /* Resources */, - B209388E6951AC88C18EE569 /* Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - 331C8086294A63A400263BE5 /* PBXTargetDependency */, - ); - name = RunnerTests; - productName = RunnerTests; - productReference = 331C8081294A63A400263BE5 /* RunnerTests.xctest */; - productType = "com.apple.product-type.bundle.unit-test"; - }; - 97C146ED1CF9000F007C117D /* Runner */ = { - isa = PBXNativeTarget; - buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; - buildPhases = ( - E0D32FA7EF8A23FC0FD30465 /* [CP] Check Pods Manifest.lock */, - 9740EEB61CF901F6004384FC /* Run Script */, - 97C146EA1CF9000F007C117D /* Sources */, - 97C146EB1CF9000F007C117D /* Frameworks */, - 97C146EC1CF9000F007C117D /* Resources */, - 9705A1C41CF9048500538489 /* Embed Frameworks */, - 3B06AD1E1E4923F5004D2608 /* Thin Binary */, - 98CA06E4ED3E0BFB8A3C613F /* [CP] Embed Pods Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = Runner; - productName = Runner; - productReference = 97C146EE1CF9000F007C117D /* Runner.app */; - productType = "com.apple.product-type.application"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 97C146E61CF9000F007C117D /* Project object */ = { - isa = PBXProject; - attributes = { - BuildIndependentTargetsInParallel = YES; - LastUpgradeCheck = 1510; - ORGANIZATIONNAME = ""; - TargetAttributes = { - 331C8080294A63A400263BE5 = { - CreatedOnToolsVersion = 14.0; - TestTargetID = 97C146ED1CF9000F007C117D; - }; - 97C146ED1CF9000F007C117D = { - CreatedOnToolsVersion = 7.3.1; - LastSwiftMigration = 1100; - }; - }; - }; - buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; - compatibilityVersion = "Xcode 9.3"; - developmentRegion = en; - hasScannedForEncodings = 0; - knownRegions = ( - en, - Base, - ); - mainGroup = 97C146E51CF9000F007C117D; - productRefGroup = 97C146EF1CF9000F007C117D /* Products */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - 97C146ED1CF9000F007C117D /* Runner */, - 331C8080294A63A400263BE5 /* RunnerTests */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXResourcesBuildPhase section */ - 331C807F294A63A400263BE5 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 97C146EC1CF9000F007C117D /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, - 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, - 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, - 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXResourcesBuildPhase section */ - -/* Begin PBXShellScriptBuildPhase section */ - 11218719EF64897AFE1F9EE8 /* [CP] Check Pods Manifest.lock */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputFileListPaths = ( - ); - inputPaths = ( - "${PODS_PODFILE_DIR_PATH}/Podfile.lock", - "${PODS_ROOT}/Manifest.lock", - ); - name = "[CP] Check Pods Manifest.lock"; - outputFileListPaths = ( - ); - outputPaths = ( - "$(DERIVED_FILE_DIR)/Pods-RunnerTests-checkManifestLockResult.txt", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; - showEnvVarsInLog = 0; - }; - 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { - isa = PBXShellScriptBuildPhase; - alwaysOutOfDate = 1; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - "${TARGET_BUILD_DIR}/${INFOPLIST_PATH}", - ); - name = "Thin Binary"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin"; - }; - 9740EEB61CF901F6004384FC /* Run Script */ = { - isa = PBXShellScriptBuildPhase; - alwaysOutOfDate = 1; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = "Run Script"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; - }; - 98CA06E4ED3E0BFB8A3C613F /* [CP] Embed Pods Frameworks */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputFileListPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist", - ); - name = "[CP] Embed Pods Frameworks"; - outputFileListPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; - showEnvVarsInLog = 0; - }; - E0D32FA7EF8A23FC0FD30465 /* [CP] Check Pods Manifest.lock */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputFileListPaths = ( - ); - inputPaths = ( - "${PODS_PODFILE_DIR_PATH}/Podfile.lock", - "${PODS_ROOT}/Manifest.lock", - ); - name = "[CP] Check Pods Manifest.lock"; - outputFileListPaths = ( - ); - outputPaths = ( - "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; - showEnvVarsInLog = 0; - }; -/* End PBXShellScriptBuildPhase section */ - -/* Begin PBXSourcesBuildPhase section */ - 331C807D294A63A400263BE5 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 331C808B294A63AB00263BE5 /* RunnerTests.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 97C146EA1CF9000F007C117D /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */, - 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin PBXTargetDependency section */ - 331C8086294A63A400263BE5 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 97C146ED1CF9000F007C117D /* Runner */; - targetProxy = 331C8085294A63A400263BE5 /* PBXContainerItemProxy */; - }; -/* End PBXTargetDependency section */ - -/* Begin PBXVariantGroup section */ - 97C146FA1CF9000F007C117D /* Main.storyboard */ = { - isa = PBXVariantGroup; - children = ( - 97C146FB1CF9000F007C117D /* Base */, - ); - name = Main.storyboard; - sourceTree = ""; - }; - 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = { - isa = PBXVariantGroup; - children = ( - 97C147001CF9000F007C117D /* Base */, - ); - name = LaunchScreen.storyboard; - sourceTree = ""; - }; -/* End PBXVariantGroup section */ - -/* Begin XCBuildConfiguration section */ - 249021D3217E4FDB00AE95B9 /* Profile */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; - CLANG_ANALYZER_NONNULL = YES; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_USER_SCRIPT_SANDBOXING = NO; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_NO_COMMON_BLOCKS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; - MTL_ENABLE_DEBUG_INFO = NO; - SDKROOT = iphoneos; - SUPPORTED_PLATFORMS = iphoneos; - TARGETED_DEVICE_FAMILY = "1,2"; - VALIDATE_PRODUCT = YES; - }; - name = Profile; - }; - 249021D4217E4FDB00AE95B9 /* Profile */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - CLANG_ENABLE_MODULES = YES; - CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; - ENABLE_BITCODE = NO; - INFOPLIST_FILE = Runner/Info.plist; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/Frameworks", - ); - PRODUCT_BUNDLE_IDENTIFIER = com.github.dartlang.objectiveCExample; - PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; - SWIFT_VERSION = 5.0; - VERSIONING_SYSTEM = "apple-generic"; - }; - name = Profile; - }; - 331C8088294A63A400263BE5 /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 5E623BDE574BD3F02055F373 /* Pods-RunnerTests.debug.xcconfig */; - buildSettings = { - BUNDLE_LOADER = "$(TEST_HOST)"; - CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 1; - GENERATE_INFOPLIST_FILE = YES; - MARKETING_VERSION = 1.0; - PRODUCT_BUNDLE_IDENTIFIER = com.github.dartlang.objectiveCExample.RunnerTests; - PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 5.0; - TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner"; - }; - name = Debug; - }; - 331C8089294A63A400263BE5 /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = F794A460162AE19694C18D43 /* Pods-RunnerTests.release.xcconfig */; - buildSettings = { - BUNDLE_LOADER = "$(TEST_HOST)"; - CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 1; - GENERATE_INFOPLIST_FILE = YES; - MARKETING_VERSION = 1.0; - PRODUCT_BUNDLE_IDENTIFIER = com.github.dartlang.objectiveCExample.RunnerTests; - PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 5.0; - TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner"; - }; - name = Release; - }; - 331C808A294A63A400263BE5 /* Profile */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 5898EAFA36C90FEB069D15C8 /* Pods-RunnerTests.profile.xcconfig */; - buildSettings = { - BUNDLE_LOADER = "$(TEST_HOST)"; - CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 1; - GENERATE_INFOPLIST_FILE = YES; - MARKETING_VERSION = 1.0; - PRODUCT_BUNDLE_IDENTIFIER = com.github.dartlang.objectiveCExample.RunnerTests; - PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 5.0; - TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner"; - }; - name = Profile; - }; - 97C147031CF9000F007C117D /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; - CLANG_ANALYZER_NONNULL = YES; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = dwarf; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_TESTABILITY = YES; - ENABLE_USER_SCRIPT_SANDBOXING = NO; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_DYNAMIC_NO_PIC = NO; - GCC_NO_COMMON_BLOCKS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; - MTL_ENABLE_DEBUG_INFO = YES; - ONLY_ACTIVE_ARCH = YES; - SDKROOT = iphoneos; - TARGETED_DEVICE_FAMILY = "1,2"; - }; - name = Debug; - }; - 97C147041CF9000F007C117D /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; - CLANG_ANALYZER_NONNULL = YES; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_USER_SCRIPT_SANDBOXING = NO; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_NO_COMMON_BLOCKS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; - MTL_ENABLE_DEBUG_INFO = NO; - SDKROOT = iphoneos; - SUPPORTED_PLATFORMS = iphoneos; - SWIFT_COMPILATION_MODE = wholemodule; - SWIFT_OPTIMIZATION_LEVEL = "-O"; - TARGETED_DEVICE_FAMILY = "1,2"; - VALIDATE_PRODUCT = YES; - }; - name = Release; - }; - 97C147061CF9000F007C117D /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - CLANG_ENABLE_MODULES = YES; - CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; - ENABLE_BITCODE = NO; - INFOPLIST_FILE = Runner/Info.plist; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/Frameworks", - ); - PRODUCT_BUNDLE_IDENTIFIER = com.github.dartlang.objectiveCExample; - PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 5.0; - VERSIONING_SYSTEM = "apple-generic"; - }; - name = Debug; - }; - 97C147071CF9000F007C117D /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - CLANG_ENABLE_MODULES = YES; - CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; - ENABLE_BITCODE = NO; - INFOPLIST_FILE = Runner/Info.plist; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/Frameworks", - ); - PRODUCT_BUNDLE_IDENTIFIER = com.github.dartlang.objectiveCExample; - PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; - SWIFT_VERSION = 5.0; - VERSIONING_SYSTEM = "apple-generic"; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 331C8087294A63A400263BE5 /* Build configuration list for PBXNativeTarget "RunnerTests" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 331C8088294A63A400263BE5 /* Debug */, - 331C8089294A63A400263BE5 /* Release */, - 331C808A294A63A400263BE5 /* Profile */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 97C147031CF9000F007C117D /* Debug */, - 97C147041CF9000F007C117D /* Release */, - 249021D3217E4FDB00AE95B9 /* Profile */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 97C147061CF9000F007C117D /* Debug */, - 97C147071CF9000F007C117D /* Release */, - 249021D4217E4FDB00AE95B9 /* Profile */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = 97C146E61CF9000F007C117D /* Project object */; -} diff --git a/pkgs/objective_c/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/pkgs/objective_c/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index 919434a62..000000000 --- a/pkgs/objective_c/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,7 +0,0 @@ - - - - - diff --git a/pkgs/objective_c/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/pkgs/objective_c/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist deleted file mode 100644 index 18d981003..000000000 --- a/pkgs/objective_c/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +++ /dev/null @@ -1,8 +0,0 @@ - - - - - IDEDidComputeMac32BitWarning - - - diff --git a/pkgs/objective_c/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/pkgs/objective_c/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings deleted file mode 100644 index f9b0d7c5e..000000000 --- a/pkgs/objective_c/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings +++ /dev/null @@ -1,8 +0,0 @@ - - - - - PreviewsEnabled - - - diff --git a/pkgs/objective_c/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/pkgs/objective_c/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme deleted file mode 100644 index 8e3ca5dfe..000000000 --- a/pkgs/objective_c/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +++ /dev/null @@ -1,98 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/pkgs/objective_c/example/ios/Runner.xcworkspace/contents.xcworkspacedata b/pkgs/objective_c/example/ios/Runner.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index 21a3cc14c..000000000 --- a/pkgs/objective_c/example/ios/Runner.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - diff --git a/pkgs/objective_c/example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/pkgs/objective_c/example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist deleted file mode 100644 index 18d981003..000000000 --- a/pkgs/objective_c/example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +++ /dev/null @@ -1,8 +0,0 @@ - - - - - IDEDidComputeMac32BitWarning - - - diff --git a/pkgs/objective_c/example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/pkgs/objective_c/example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings deleted file mode 100644 index f9b0d7c5e..000000000 --- a/pkgs/objective_c/example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings +++ /dev/null @@ -1,8 +0,0 @@ - - - - - PreviewsEnabled - - - diff --git a/pkgs/objective_c/example/ios/Runner/AppDelegate.swift b/pkgs/objective_c/example/ios/Runner/AppDelegate.swift deleted file mode 100644 index 626664468..000000000 --- a/pkgs/objective_c/example/ios/Runner/AppDelegate.swift +++ /dev/null @@ -1,13 +0,0 @@ -import Flutter -import UIKit - -@main -@objc class AppDelegate: FlutterAppDelegate { - override func application( - _ application: UIApplication, - didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? - ) -> Bool { - GeneratedPluginRegistrant.register(with: self) - return super.application(application, didFinishLaunchingWithOptions: launchOptions) - } -} diff --git a/pkgs/objective_c/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json b/pkgs/objective_c/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json deleted file mode 100644 index d36b1fab2..000000000 --- a/pkgs/objective_c/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json +++ /dev/null @@ -1,122 +0,0 @@ -{ - "images" : [ - { - "size" : "20x20", - "idiom" : "iphone", - "filename" : "Icon-App-20x20@2x.png", - "scale" : "2x" - }, - { - "size" : "20x20", - "idiom" : "iphone", - "filename" : "Icon-App-20x20@3x.png", - "scale" : "3x" - }, - { - "size" : "29x29", - "idiom" : "iphone", - "filename" : "Icon-App-29x29@1x.png", - "scale" : "1x" - }, - { - "size" : "29x29", - "idiom" : "iphone", - "filename" : "Icon-App-29x29@2x.png", - "scale" : "2x" - }, - { - "size" : "29x29", - "idiom" : "iphone", - "filename" : "Icon-App-29x29@3x.png", - "scale" : "3x" - }, - { - "size" : "40x40", - "idiom" : "iphone", - "filename" : "Icon-App-40x40@2x.png", - "scale" : "2x" - }, - { - "size" : "40x40", - "idiom" : "iphone", - "filename" : "Icon-App-40x40@3x.png", - "scale" : "3x" - }, - { - "size" : "60x60", - "idiom" : "iphone", - "filename" : "Icon-App-60x60@2x.png", - "scale" : "2x" - }, - { - "size" : "60x60", - "idiom" : "iphone", - "filename" : "Icon-App-60x60@3x.png", - "scale" : "3x" - }, - { - "size" : "20x20", - "idiom" : "ipad", - "filename" : "Icon-App-20x20@1x.png", - "scale" : "1x" - }, - { - "size" : "20x20", - "idiom" : "ipad", - "filename" : "Icon-App-20x20@2x.png", - "scale" : "2x" - }, - { - "size" : "29x29", - "idiom" : "ipad", - "filename" : "Icon-App-29x29@1x.png", - "scale" : "1x" - }, - { - "size" : "29x29", - "idiom" : "ipad", - "filename" : "Icon-App-29x29@2x.png", - "scale" : "2x" - }, - { - "size" : "40x40", - "idiom" : "ipad", - "filename" : "Icon-App-40x40@1x.png", - "scale" : "1x" - }, - { - "size" : "40x40", - "idiom" : "ipad", - "filename" : "Icon-App-40x40@2x.png", - "scale" : "2x" - }, - { - "size" : "76x76", - "idiom" : "ipad", - "filename" : "Icon-App-76x76@1x.png", - "scale" : "1x" - }, - { - "size" : "76x76", - "idiom" : "ipad", - "filename" : "Icon-App-76x76@2x.png", - "scale" : "2x" - }, - { - "size" : "83.5x83.5", - "idiom" : "ipad", - "filename" : "Icon-App-83.5x83.5@2x.png", - "scale" : "2x" - }, - { - "size" : "1024x1024", - "idiom" : "ios-marketing", - "filename" : "Icon-App-1024x1024@1x.png", - "scale" : "1x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} diff --git a/pkgs/objective_c/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png b/pkgs/objective_c/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png deleted file mode 100644 index dc9ada472..000000000 Binary files a/pkgs/objective_c/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png and /dev/null differ diff --git a/pkgs/objective_c/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png b/pkgs/objective_c/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png deleted file mode 100644 index 7353c41ec..000000000 Binary files a/pkgs/objective_c/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png and /dev/null differ diff --git a/pkgs/objective_c/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png b/pkgs/objective_c/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png deleted file mode 100644 index 797d452e4..000000000 Binary files a/pkgs/objective_c/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png and /dev/null differ diff --git a/pkgs/objective_c/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png b/pkgs/objective_c/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png deleted file mode 100644 index 6ed2d933e..000000000 Binary files a/pkgs/objective_c/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png and /dev/null differ diff --git a/pkgs/objective_c/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png b/pkgs/objective_c/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png deleted file mode 100644 index 4cd7b0099..000000000 Binary files a/pkgs/objective_c/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png and /dev/null differ diff --git a/pkgs/objective_c/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png b/pkgs/objective_c/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png deleted file mode 100644 index fe730945a..000000000 Binary files a/pkgs/objective_c/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png and /dev/null differ diff --git a/pkgs/objective_c/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png b/pkgs/objective_c/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png deleted file mode 100644 index 321773cd8..000000000 Binary files a/pkgs/objective_c/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png and /dev/null differ diff --git a/pkgs/objective_c/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png b/pkgs/objective_c/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png deleted file mode 100644 index 797d452e4..000000000 Binary files a/pkgs/objective_c/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png and /dev/null differ diff --git a/pkgs/objective_c/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png b/pkgs/objective_c/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png deleted file mode 100644 index 502f463a9..000000000 Binary files a/pkgs/objective_c/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png and /dev/null differ diff --git a/pkgs/objective_c/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png b/pkgs/objective_c/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png deleted file mode 100644 index 0ec303439..000000000 Binary files a/pkgs/objective_c/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png and /dev/null differ diff --git a/pkgs/objective_c/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png b/pkgs/objective_c/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png deleted file mode 100644 index 0ec303439..000000000 Binary files a/pkgs/objective_c/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png and /dev/null differ diff --git a/pkgs/objective_c/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png b/pkgs/objective_c/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png deleted file mode 100644 index e9f5fea27..000000000 Binary files a/pkgs/objective_c/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png and /dev/null differ diff --git a/pkgs/objective_c/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png b/pkgs/objective_c/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png deleted file mode 100644 index 84ac32ae7..000000000 Binary files a/pkgs/objective_c/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png and /dev/null differ diff --git a/pkgs/objective_c/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png b/pkgs/objective_c/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png deleted file mode 100644 index 8953cba09..000000000 Binary files a/pkgs/objective_c/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png and /dev/null differ diff --git a/pkgs/objective_c/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png b/pkgs/objective_c/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png deleted file mode 100644 index 0467bf12a..000000000 Binary files a/pkgs/objective_c/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png and /dev/null differ diff --git a/pkgs/objective_c/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json b/pkgs/objective_c/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json deleted file mode 100644 index 0bedcf2fd..000000000 --- a/pkgs/objective_c/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "filename" : "LaunchImage.png", - "scale" : "1x" - }, - { - "idiom" : "universal", - "filename" : "LaunchImage@2x.png", - "scale" : "2x" - }, - { - "idiom" : "universal", - "filename" : "LaunchImage@3x.png", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} diff --git a/pkgs/objective_c/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png b/pkgs/objective_c/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png deleted file mode 100644 index 9da19eaca..000000000 Binary files a/pkgs/objective_c/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png and /dev/null differ diff --git a/pkgs/objective_c/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png b/pkgs/objective_c/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png deleted file mode 100644 index 9da19eaca..000000000 Binary files a/pkgs/objective_c/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png and /dev/null differ diff --git a/pkgs/objective_c/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png b/pkgs/objective_c/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png deleted file mode 100644 index 9da19eaca..000000000 Binary files a/pkgs/objective_c/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png and /dev/null differ diff --git a/pkgs/objective_c/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md b/pkgs/objective_c/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md deleted file mode 100644 index 89c2725b7..000000000 --- a/pkgs/objective_c/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md +++ /dev/null @@ -1,5 +0,0 @@ -# Launch Screen Assets - -You can customize the launch screen with your own desired assets by replacing the image files in this directory. - -You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images. \ No newline at end of file diff --git a/pkgs/objective_c/example/ios/Runner/Base.lproj/LaunchScreen.storyboard b/pkgs/objective_c/example/ios/Runner/Base.lproj/LaunchScreen.storyboard deleted file mode 100644 index f2e259c7c..000000000 --- a/pkgs/objective_c/example/ios/Runner/Base.lproj/LaunchScreen.storyboard +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/pkgs/objective_c/example/ios/Runner/Base.lproj/Main.storyboard b/pkgs/objective_c/example/ios/Runner/Base.lproj/Main.storyboard deleted file mode 100644 index f3c28516f..000000000 --- a/pkgs/objective_c/example/ios/Runner/Base.lproj/Main.storyboard +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/pkgs/objective_c/example/ios/Runner/Info.plist b/pkgs/objective_c/example/ios/Runner/Info.plist deleted file mode 100644 index 8bbbc6dc9..000000000 --- a/pkgs/objective_c/example/ios/Runner/Info.plist +++ /dev/null @@ -1,49 +0,0 @@ - - - - - CFBundleDevelopmentRegion - $(DEVELOPMENT_LANGUAGE) - CFBundleDisplayName - Objective C - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - objective_c_example - CFBundlePackageType - APPL - CFBundleShortVersionString - $(FLUTTER_BUILD_NAME) - CFBundleSignature - ???? - CFBundleVersion - $(FLUTTER_BUILD_NUMBER) - LSRequiresIPhoneOS - - UILaunchStoryboardName - LaunchScreen - UIMainStoryboardFile - Main - UISupportedInterfaceOrientations - - UIInterfaceOrientationPortrait - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight - - UISupportedInterfaceOrientations~ipad - - UIInterfaceOrientationPortrait - UIInterfaceOrientationPortraitUpsideDown - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight - - CADisableMinimumFrameDurationOnPhone - - UIApplicationSupportsIndirectInputEvents - - - diff --git a/pkgs/objective_c/example/ios/Runner/Runner-Bridging-Header.h b/pkgs/objective_c/example/ios/Runner/Runner-Bridging-Header.h deleted file mode 100644 index 308a2a560..000000000 --- a/pkgs/objective_c/example/ios/Runner/Runner-Bridging-Header.h +++ /dev/null @@ -1 +0,0 @@ -#import "GeneratedPluginRegistrant.h" diff --git a/pkgs/objective_c/example/ios/RunnerTests/RunnerTests.swift b/pkgs/objective_c/example/ios/RunnerTests/RunnerTests.swift deleted file mode 100644 index 86a7c3b1b..000000000 --- a/pkgs/objective_c/example/ios/RunnerTests/RunnerTests.swift +++ /dev/null @@ -1,12 +0,0 @@ -import Flutter -import UIKit -import XCTest - -class RunnerTests: XCTestCase { - - func testExample() { - // If you add code to the Runner application, consider adding tests here. - // See https://developer.apple.com/documentation/xctest for more information about using XCTest. - } - -} diff --git a/pkgs/objective_c/example/lib/main.dart b/pkgs/objective_c/example/lib/main.dart index e6c44abd1..6bf9da655 100644 --- a/pkgs/objective_c/example/lib/main.dart +++ b/pkgs/objective_c/example/lib/main.dart @@ -1,33 +1,10 @@ -// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file -// for details. All rights reserved. Use of this source code is governed by a -// BSD-style license that can be found in the LICENSE file. +import 'dart:io'; -import 'package:flutter/material.dart'; import 'package:objective_c/objective_c.dart'; void main() { - runApp(const MaterialApp(home: MainApp())); -} - -class MainApp extends StatefulWidget { - const MainApp({super.key}); - - @override - State createState() => _MainAppState(); -} - -class _MainAppState extends State { - late final String message; - - @override - void initState() { - super.initState(); - - message = NSString('Hello World!').toString(); - } + // Objective-C is only supported on macOS and iOS. + assert(Platform.isMacOS || Platform.isIOS); - @override - Widget build(BuildContext context) { - return Scaffold(body: Center(child: Text(message))); - } + print('Hello World'.toNSString().toDartString()); } diff --git a/pkgs/objective_c/example/macos/Flutter/Flutter-Debug.xcconfig b/pkgs/objective_c/example/macos/Flutter/Flutter-Debug.xcconfig deleted file mode 100644 index 4b81f9b2d..000000000 --- a/pkgs/objective_c/example/macos/Flutter/Flutter-Debug.xcconfig +++ /dev/null @@ -1,2 +0,0 @@ -#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" -#include "ephemeral/Flutter-Generated.xcconfig" diff --git a/pkgs/objective_c/example/macos/Flutter/Flutter-Release.xcconfig b/pkgs/objective_c/example/macos/Flutter/Flutter-Release.xcconfig deleted file mode 100644 index 5caa9d157..000000000 --- a/pkgs/objective_c/example/macos/Flutter/Flutter-Release.xcconfig +++ /dev/null @@ -1,2 +0,0 @@ -#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" -#include "ephemeral/Flutter-Generated.xcconfig" diff --git a/pkgs/objective_c/example/macos/Podfile b/pkgs/objective_c/example/macos/Podfile deleted file mode 100644 index c795730db..000000000 --- a/pkgs/objective_c/example/macos/Podfile +++ /dev/null @@ -1,43 +0,0 @@ -platform :osx, '10.14' - -# CocoaPods analytics sends network stats synchronously affecting flutter build latency. -ENV['COCOAPODS_DISABLE_STATS'] = 'true' - -project 'Runner', { - 'Debug' => :debug, - 'Profile' => :release, - 'Release' => :release, -} - -def flutter_root - generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'ephemeral', 'Flutter-Generated.xcconfig'), __FILE__) - unless File.exist?(generated_xcode_build_settings_path) - raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure \"flutter pub get\" is executed first" - end - - File.foreach(generated_xcode_build_settings_path) do |line| - matches = line.match(/FLUTTER_ROOT\=(.*)/) - return matches[1].strip if matches - end - raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Flutter-Generated.xcconfig, then run \"flutter pub get\"" -end - -require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) - -flutter_macos_podfile_setup - -target 'Runner' do - use_frameworks! - use_modular_headers! - - flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__)) - target 'RunnerTests' do - inherit! :search_paths - end -end - -post_install do |installer| - installer.pods_project.targets.each do |target| - flutter_additional_macos_build_settings(target) - end -end diff --git a/pkgs/objective_c/example/macos/Runner.xcodeproj/project.pbxproj b/pkgs/objective_c/example/macos/Runner.xcodeproj/project.pbxproj deleted file mode 100644 index 7fb6863fb..000000000 --- a/pkgs/objective_c/example/macos/Runner.xcodeproj/project.pbxproj +++ /dev/null @@ -1,801 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 54; - objects = { - -/* Begin PBXAggregateTarget section */ - 33CC111A2044C6BA0003C045 /* Flutter Assemble */ = { - isa = PBXAggregateTarget; - buildConfigurationList = 33CC111B2044C6BA0003C045 /* Build configuration list for PBXAggregateTarget "Flutter Assemble" */; - buildPhases = ( - 33CC111E2044C6BF0003C045 /* ShellScript */, - ); - dependencies = ( - ); - name = "Flutter Assemble"; - productName = FLX; - }; -/* End PBXAggregateTarget section */ - -/* Begin PBXBuildFile section */ - 331C80D8294CF71000263BE5 /* RunnerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 331C80D7294CF71000263BE5 /* RunnerTests.swift */; }; - 335BBD1B22A9A15E00E9071D /* GeneratedPluginRegistrant.swift in Sources */ = {isa = PBXBuildFile; fileRef = 335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */; }; - 33CC10F12044A3C60003C045 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33CC10F02044A3C60003C045 /* AppDelegate.swift */; }; - 33CC10F32044A3C60003C045 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F22044A3C60003C045 /* Assets.xcassets */; }; - 33CC10F62044A3C60003C045 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F42044A3C60003C045 /* MainMenu.xib */; }; - 33CC11132044BFA00003C045 /* MainFlutterWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */; }; - 5C3BF24AE85F5C730B12E1C3 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 76CD4A3B26D45B1D35ED40BC /* Pods_Runner.framework */; }; - 98677E5D0F050EAF7F207C67 /* Pods_RunnerTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6A9FB1952D96C5AEFCA4D69B /* Pods_RunnerTests.framework */; }; -/* End PBXBuildFile section */ - -/* Begin PBXContainerItemProxy section */ - 331C80D9294CF71000263BE5 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 33CC10E52044A3C60003C045 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 33CC10EC2044A3C60003C045; - remoteInfo = Runner; - }; - 33CC111F2044C79F0003C045 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 33CC10E52044A3C60003C045 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 33CC111A2044C6BA0003C045; - remoteInfo = FLX; - }; -/* End PBXContainerItemProxy section */ - -/* Begin PBXCopyFilesBuildPhase section */ - 33CC110E2044A8840003C045 /* Bundle Framework */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = ""; - dstSubfolderSpec = 10; - files = ( - ); - name = "Bundle Framework"; - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXCopyFilesBuildPhase section */ - -/* Begin PBXFileReference section */ - 253A21F847FB1AF244672D0E /* Pods-RunnerTests.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.profile.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.profile.xcconfig"; sourceTree = ""; }; - 331C80D5294CF71000263BE5 /* RunnerTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RunnerTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; - 331C80D7294CF71000263BE5 /* RunnerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RunnerTests.swift; sourceTree = ""; }; - 333000ED22D3DE5D00554162 /* Warnings.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Warnings.xcconfig; sourceTree = ""; }; - 335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GeneratedPluginRegistrant.swift; sourceTree = ""; }; - 33CC10ED2044A3C60003C045 /* objective_c_example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = objective_c_example.app; sourceTree = BUILT_PRODUCTS_DIR; }; - 33CC10F02044A3C60003C045 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; - 33CC10F22044A3C60003C045 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Assets.xcassets; path = Runner/Assets.xcassets; sourceTree = ""; }; - 33CC10F52044A3C60003C045 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = ""; }; - 33CC10F72044A3C60003C045 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = Info.plist; path = Runner/Info.plist; sourceTree = ""; }; - 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainFlutterWindow.swift; sourceTree = ""; }; - 33CEB47222A05771004F2AC0 /* Flutter-Debug.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Flutter-Debug.xcconfig"; sourceTree = ""; }; - 33CEB47422A05771004F2AC0 /* Flutter-Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Flutter-Release.xcconfig"; sourceTree = ""; }; - 33CEB47722A0578A004F2AC0 /* Flutter-Generated.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = "Flutter-Generated.xcconfig"; path = "ephemeral/Flutter-Generated.xcconfig"; sourceTree = ""; }; - 33E51913231747F40026EE4D /* DebugProfile.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = DebugProfile.entitlements; sourceTree = ""; }; - 33E51914231749380026EE4D /* Release.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.entitlements; path = Release.entitlements; sourceTree = ""; }; - 33E5194F232828860026EE4D /* AppInfo.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = AppInfo.xcconfig; sourceTree = ""; }; - 6A9FB1952D96C5AEFCA4D69B /* Pods_RunnerTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_RunnerTests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - 76CD4A3B26D45B1D35ED40BC /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Release.xcconfig; sourceTree = ""; }; - 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Debug.xcconfig; sourceTree = ""; }; - AC25B0021603A0772CA9840F /* Pods-RunnerTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.release.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.release.xcconfig"; sourceTree = ""; }; - E5900647B1760244CA95C2A6 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; }; - E739196F186306D59FB11177 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; - ECD2E4ECDB0FCE6DA971A318 /* Pods-RunnerTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.debug.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.debug.xcconfig"; sourceTree = ""; }; - EE079268A4FB02480F3FCA89 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 331C80D2294CF70F00263BE5 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 98677E5D0F050EAF7F207C67 /* Pods_RunnerTests.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 33CC10EA2044A3C60003C045 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 5C3BF24AE85F5C730B12E1C3 /* Pods_Runner.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 331C80D6294CF71000263BE5 /* RunnerTests */ = { - isa = PBXGroup; - children = ( - 331C80D7294CF71000263BE5 /* RunnerTests.swift */, - ); - path = RunnerTests; - sourceTree = ""; - }; - 33BA886A226E78AF003329D5 /* Configs */ = { - isa = PBXGroup; - children = ( - 33E5194F232828860026EE4D /* AppInfo.xcconfig */, - 9740EEB21CF90195004384FC /* Debug.xcconfig */, - 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, - 333000ED22D3DE5D00554162 /* Warnings.xcconfig */, - ); - path = Configs; - sourceTree = ""; - }; - 33CC10E42044A3C60003C045 = { - isa = PBXGroup; - children = ( - 33FAB671232836740065AC1E /* Runner */, - 33CEB47122A05771004F2AC0 /* Flutter */, - 331C80D6294CF71000263BE5 /* RunnerTests */, - 33CC10EE2044A3C60003C045 /* Products */, - D73912EC22F37F3D000D13A0 /* Frameworks */, - 96BE0B041091E6177B65072F /* Pods */, - ); - sourceTree = ""; - }; - 33CC10EE2044A3C60003C045 /* Products */ = { - isa = PBXGroup; - children = ( - 33CC10ED2044A3C60003C045 /* objective_c_example.app */, - 331C80D5294CF71000263BE5 /* RunnerTests.xctest */, - ); - name = Products; - sourceTree = ""; - }; - 33CC11242044D66E0003C045 /* Resources */ = { - isa = PBXGroup; - children = ( - 33CC10F22044A3C60003C045 /* Assets.xcassets */, - 33CC10F42044A3C60003C045 /* MainMenu.xib */, - 33CC10F72044A3C60003C045 /* Info.plist */, - ); - name = Resources; - path = ..; - sourceTree = ""; - }; - 33CEB47122A05771004F2AC0 /* Flutter */ = { - isa = PBXGroup; - children = ( - 335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */, - 33CEB47222A05771004F2AC0 /* Flutter-Debug.xcconfig */, - 33CEB47422A05771004F2AC0 /* Flutter-Release.xcconfig */, - 33CEB47722A0578A004F2AC0 /* Flutter-Generated.xcconfig */, - ); - path = Flutter; - sourceTree = ""; - }; - 33FAB671232836740065AC1E /* Runner */ = { - isa = PBXGroup; - children = ( - 33CC10F02044A3C60003C045 /* AppDelegate.swift */, - 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */, - 33E51913231747F40026EE4D /* DebugProfile.entitlements */, - 33E51914231749380026EE4D /* Release.entitlements */, - 33CC11242044D66E0003C045 /* Resources */, - 33BA886A226E78AF003329D5 /* Configs */, - ); - path = Runner; - sourceTree = ""; - }; - 96BE0B041091E6177B65072F /* Pods */ = { - isa = PBXGroup; - children = ( - EE079268A4FB02480F3FCA89 /* Pods-Runner.debug.xcconfig */, - E739196F186306D59FB11177 /* Pods-Runner.release.xcconfig */, - E5900647B1760244CA95C2A6 /* Pods-Runner.profile.xcconfig */, - ECD2E4ECDB0FCE6DA971A318 /* Pods-RunnerTests.debug.xcconfig */, - AC25B0021603A0772CA9840F /* Pods-RunnerTests.release.xcconfig */, - 253A21F847FB1AF244672D0E /* Pods-RunnerTests.profile.xcconfig */, - ); - name = Pods; - path = Pods; - sourceTree = ""; - }; - D73912EC22F37F3D000D13A0 /* Frameworks */ = { - isa = PBXGroup; - children = ( - 76CD4A3B26D45B1D35ED40BC /* Pods_Runner.framework */, - 6A9FB1952D96C5AEFCA4D69B /* Pods_RunnerTests.framework */, - ); - name = Frameworks; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXNativeTarget section */ - 331C80D4294CF70F00263BE5 /* RunnerTests */ = { - isa = PBXNativeTarget; - buildConfigurationList = 331C80DE294CF71000263BE5 /* Build configuration list for PBXNativeTarget "RunnerTests" */; - buildPhases = ( - DD8A915821E91B2D640F20A1 /* [CP] Check Pods Manifest.lock */, - 331C80D1294CF70F00263BE5 /* Sources */, - 331C80D2294CF70F00263BE5 /* Frameworks */, - 331C80D3294CF70F00263BE5 /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - 331C80DA294CF71000263BE5 /* PBXTargetDependency */, - ); - name = RunnerTests; - productName = RunnerTests; - productReference = 331C80D5294CF71000263BE5 /* RunnerTests.xctest */; - productType = "com.apple.product-type.bundle.unit-test"; - }; - 33CC10EC2044A3C60003C045 /* Runner */ = { - isa = PBXNativeTarget; - buildConfigurationList = 33CC10FB2044A3C60003C045 /* Build configuration list for PBXNativeTarget "Runner" */; - buildPhases = ( - FF16D30B988DB2BCD781BB14 /* [CP] Check Pods Manifest.lock */, - 33CC10E92044A3C60003C045 /* Sources */, - 33CC10EA2044A3C60003C045 /* Frameworks */, - 33CC10EB2044A3C60003C045 /* Resources */, - 33CC110E2044A8840003C045 /* Bundle Framework */, - 3399D490228B24CF009A79C7 /* ShellScript */, - 774CDE4872C6F2C91B1264E0 /* [CP] Embed Pods Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - 33CC11202044C79F0003C045 /* PBXTargetDependency */, - ); - name = Runner; - productName = Runner; - productReference = 33CC10ED2044A3C60003C045 /* objective_c_example.app */; - productType = "com.apple.product-type.application"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 33CC10E52044A3C60003C045 /* Project object */ = { - isa = PBXProject; - attributes = { - BuildIndependentTargetsInParallel = YES; - LastSwiftUpdateCheck = 0920; - LastUpgradeCheck = 1510; - ORGANIZATIONNAME = ""; - TargetAttributes = { - 331C80D4294CF70F00263BE5 = { - CreatedOnToolsVersion = 14.0; - TestTargetID = 33CC10EC2044A3C60003C045; - }; - 33CC10EC2044A3C60003C045 = { - CreatedOnToolsVersion = 9.2; - LastSwiftMigration = 1100; - ProvisioningStyle = Automatic; - SystemCapabilities = { - com.apple.Sandbox = { - enabled = 1; - }; - }; - }; - 33CC111A2044C6BA0003C045 = { - CreatedOnToolsVersion = 9.2; - ProvisioningStyle = Manual; - }; - }; - }; - buildConfigurationList = 33CC10E82044A3C60003C045 /* Build configuration list for PBXProject "Runner" */; - compatibilityVersion = "Xcode 9.3"; - developmentRegion = en; - hasScannedForEncodings = 0; - knownRegions = ( - en, - Base, - ); - mainGroup = 33CC10E42044A3C60003C045; - productRefGroup = 33CC10EE2044A3C60003C045 /* Products */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - 33CC10EC2044A3C60003C045 /* Runner */, - 331C80D4294CF70F00263BE5 /* RunnerTests */, - 33CC111A2044C6BA0003C045 /* Flutter Assemble */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXResourcesBuildPhase section */ - 331C80D3294CF70F00263BE5 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 33CC10EB2044A3C60003C045 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 33CC10F32044A3C60003C045 /* Assets.xcassets in Resources */, - 33CC10F62044A3C60003C045 /* MainMenu.xib in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXResourcesBuildPhase section */ - -/* Begin PBXShellScriptBuildPhase section */ - 3399D490228B24CF009A79C7 /* ShellScript */ = { - isa = PBXShellScriptBuildPhase; - alwaysOutOfDate = 1; - buildActionMask = 2147483647; - files = ( - ); - inputFileListPaths = ( - ); - inputPaths = ( - ); - outputFileListPaths = ( - ); - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "echo \"$PRODUCT_NAME.app\" > \"$PROJECT_DIR\"/Flutter/ephemeral/.app_filename && \"$FLUTTER_ROOT\"/packages/flutter_tools/bin/macos_assemble.sh embed\n"; - }; - 33CC111E2044C6BF0003C045 /* ShellScript */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputFileListPaths = ( - Flutter/ephemeral/FlutterInputs.xcfilelist, - ); - inputPaths = ( - Flutter/ephemeral/tripwire, - ); - outputFileListPaths = ( - Flutter/ephemeral/FlutterOutputs.xcfilelist, - ); - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"$FLUTTER_ROOT\"/packages/flutter_tools/bin/macos_assemble.sh && touch Flutter/ephemeral/tripwire"; - }; - 774CDE4872C6F2C91B1264E0 /* [CP] Embed Pods Frameworks */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputFileListPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist", - ); - name = "[CP] Embed Pods Frameworks"; - outputFileListPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; - showEnvVarsInLog = 0; - }; - DD8A915821E91B2D640F20A1 /* [CP] Check Pods Manifest.lock */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputFileListPaths = ( - ); - inputPaths = ( - "${PODS_PODFILE_DIR_PATH}/Podfile.lock", - "${PODS_ROOT}/Manifest.lock", - ); - name = "[CP] Check Pods Manifest.lock"; - outputFileListPaths = ( - ); - outputPaths = ( - "$(DERIVED_FILE_DIR)/Pods-RunnerTests-checkManifestLockResult.txt", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; - showEnvVarsInLog = 0; - }; - FF16D30B988DB2BCD781BB14 /* [CP] Check Pods Manifest.lock */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputFileListPaths = ( - ); - inputPaths = ( - "${PODS_PODFILE_DIR_PATH}/Podfile.lock", - "${PODS_ROOT}/Manifest.lock", - ); - name = "[CP] Check Pods Manifest.lock"; - outputFileListPaths = ( - ); - outputPaths = ( - "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; - showEnvVarsInLog = 0; - }; -/* End PBXShellScriptBuildPhase section */ - -/* Begin PBXSourcesBuildPhase section */ - 331C80D1294CF70F00263BE5 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 331C80D8294CF71000263BE5 /* RunnerTests.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 33CC10E92044A3C60003C045 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 33CC11132044BFA00003C045 /* MainFlutterWindow.swift in Sources */, - 33CC10F12044A3C60003C045 /* AppDelegate.swift in Sources */, - 335BBD1B22A9A15E00E9071D /* GeneratedPluginRegistrant.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin PBXTargetDependency section */ - 331C80DA294CF71000263BE5 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 33CC10EC2044A3C60003C045 /* Runner */; - targetProxy = 331C80D9294CF71000263BE5 /* PBXContainerItemProxy */; - }; - 33CC11202044C79F0003C045 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 33CC111A2044C6BA0003C045 /* Flutter Assemble */; - targetProxy = 33CC111F2044C79F0003C045 /* PBXContainerItemProxy */; - }; -/* End PBXTargetDependency section */ - -/* Begin PBXVariantGroup section */ - 33CC10F42044A3C60003C045 /* MainMenu.xib */ = { - isa = PBXVariantGroup; - children = ( - 33CC10F52044A3C60003C045 /* Base */, - ); - name = MainMenu.xib; - path = Runner; - sourceTree = ""; - }; -/* End PBXVariantGroup section */ - -/* Begin XCBuildConfiguration section */ - 331C80DB294CF71000263BE5 /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = ECD2E4ECDB0FCE6DA971A318 /* Pods-RunnerTests.debug.xcconfig */; - buildSettings = { - BUNDLE_LOADER = "$(TEST_HOST)"; - CURRENT_PROJECT_VERSION = 1; - GENERATE_INFOPLIST_FILE = YES; - MARKETING_VERSION = 1.0; - PRODUCT_BUNDLE_IDENTIFIER = com.github.dartlang.objectiveCExample.RunnerTests; - PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 5.0; - TEST_HOST = "$(BUILT_PRODUCTS_DIR)/objective_c_example.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/objective_c_example"; - }; - name = Debug; - }; - 331C80DC294CF71000263BE5 /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = AC25B0021603A0772CA9840F /* Pods-RunnerTests.release.xcconfig */; - buildSettings = { - BUNDLE_LOADER = "$(TEST_HOST)"; - CURRENT_PROJECT_VERSION = 1; - GENERATE_INFOPLIST_FILE = YES; - MARKETING_VERSION = 1.0; - PRODUCT_BUNDLE_IDENTIFIER = com.github.dartlang.objectiveCExample.RunnerTests; - PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 5.0; - TEST_HOST = "$(BUILT_PRODUCTS_DIR)/objective_c_example.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/objective_c_example"; - }; - name = Release; - }; - 331C80DD294CF71000263BE5 /* Profile */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 253A21F847FB1AF244672D0E /* Pods-RunnerTests.profile.xcconfig */; - buildSettings = { - BUNDLE_LOADER = "$(TEST_HOST)"; - CURRENT_PROJECT_VERSION = 1; - GENERATE_INFOPLIST_FILE = YES; - MARKETING_VERSION = 1.0; - PRODUCT_BUNDLE_IDENTIFIER = com.github.dartlang.objectiveCExample.RunnerTests; - PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 5.0; - TEST_HOST = "$(BUILT_PRODUCTS_DIR)/objective_c_example.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/objective_c_example"; - }; - name = Profile; - }; - 338D0CE9231458BD00FA5F75 /* Profile */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; - CLANG_ANALYZER_NONNULL = YES; - CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CODE_SIGN_IDENTITY = "-"; - COPY_PHASE_STRIP = NO; - DEAD_CODE_STRIPPING = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_USER_SCRIPT_SANDBOXING = NO; - GCC_C_LANGUAGE_STANDARD = gnu11; - GCC_NO_COMMON_BLOCKS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.14; - MTL_ENABLE_DEBUG_INFO = NO; - SDKROOT = macosx; - SWIFT_COMPILATION_MODE = wholemodule; - SWIFT_OPTIMIZATION_LEVEL = "-O"; - }; - name = Profile; - }; - 338D0CEA231458BD00FA5F75 /* Profile */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 33E5194F232828860026EE4D /* AppInfo.xcconfig */; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - CLANG_ENABLE_MODULES = YES; - CODE_SIGN_ENTITLEMENTS = Runner/DebugProfile.entitlements; - CODE_SIGN_STYLE = Automatic; - COMBINE_HIDPI_IMAGES = YES; - INFOPLIST_FILE = Runner/Info.plist; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/../Frameworks", - ); - PROVISIONING_PROFILE_SPECIFIER = ""; - SWIFT_VERSION = 5.0; - }; - name = Profile; - }; - 338D0CEB231458BD00FA5F75 /* Profile */ = { - isa = XCBuildConfiguration; - buildSettings = { - CODE_SIGN_STYLE = Manual; - PRODUCT_NAME = "$(TARGET_NAME)"; - }; - name = Profile; - }; - 33CC10F92044A3C60003C045 /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; - CLANG_ANALYZER_NONNULL = YES; - CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CODE_SIGN_IDENTITY = "-"; - COPY_PHASE_STRIP = NO; - DEAD_CODE_STRIPPING = YES; - DEBUG_INFORMATION_FORMAT = dwarf; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_TESTABILITY = YES; - ENABLE_USER_SCRIPT_SANDBOXING = NO; - GCC_C_LANGUAGE_STANDARD = gnu11; - GCC_DYNAMIC_NO_PIC = NO; - GCC_NO_COMMON_BLOCKS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.14; - MTL_ENABLE_DEBUG_INFO = YES; - ONLY_ACTIVE_ARCH = YES; - SDKROOT = macosx; - SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - }; - name = Debug; - }; - 33CC10FA2044A3C60003C045 /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; - CLANG_ANALYZER_NONNULL = YES; - CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CODE_SIGN_IDENTITY = "-"; - COPY_PHASE_STRIP = NO; - DEAD_CODE_STRIPPING = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_USER_SCRIPT_SANDBOXING = NO; - GCC_C_LANGUAGE_STANDARD = gnu11; - GCC_NO_COMMON_BLOCKS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.14; - MTL_ENABLE_DEBUG_INFO = NO; - SDKROOT = macosx; - SWIFT_COMPILATION_MODE = wholemodule; - SWIFT_OPTIMIZATION_LEVEL = "-O"; - }; - name = Release; - }; - 33CC10FC2044A3C60003C045 /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 33E5194F232828860026EE4D /* AppInfo.xcconfig */; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - CLANG_ENABLE_MODULES = YES; - CODE_SIGN_ENTITLEMENTS = Runner/DebugProfile.entitlements; - CODE_SIGN_STYLE = Automatic; - COMBINE_HIDPI_IMAGES = YES; - INFOPLIST_FILE = Runner/Info.plist; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/../Frameworks", - ); - PROVISIONING_PROFILE_SPECIFIER = ""; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 5.0; - }; - name = Debug; - }; - 33CC10FD2044A3C60003C045 /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 33E5194F232828860026EE4D /* AppInfo.xcconfig */; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - CLANG_ENABLE_MODULES = YES; - CODE_SIGN_ENTITLEMENTS = Runner/Release.entitlements; - CODE_SIGN_STYLE = Automatic; - COMBINE_HIDPI_IMAGES = YES; - INFOPLIST_FILE = Runner/Info.plist; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/../Frameworks", - ); - PROVISIONING_PROFILE_SPECIFIER = ""; - SWIFT_VERSION = 5.0; - }; - name = Release; - }; - 33CC111C2044C6BA0003C045 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - CODE_SIGN_STYLE = Manual; - PRODUCT_NAME = "$(TARGET_NAME)"; - }; - name = Debug; - }; - 33CC111D2044C6BA0003C045 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - CODE_SIGN_STYLE = Automatic; - PRODUCT_NAME = "$(TARGET_NAME)"; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 331C80DE294CF71000263BE5 /* Build configuration list for PBXNativeTarget "RunnerTests" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 331C80DB294CF71000263BE5 /* Debug */, - 331C80DC294CF71000263BE5 /* Release */, - 331C80DD294CF71000263BE5 /* Profile */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 33CC10E82044A3C60003C045 /* Build configuration list for PBXProject "Runner" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 33CC10F92044A3C60003C045 /* Debug */, - 33CC10FA2044A3C60003C045 /* Release */, - 338D0CE9231458BD00FA5F75 /* Profile */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 33CC10FB2044A3C60003C045 /* Build configuration list for PBXNativeTarget "Runner" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 33CC10FC2044A3C60003C045 /* Debug */, - 33CC10FD2044A3C60003C045 /* Release */, - 338D0CEA231458BD00FA5F75 /* Profile */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 33CC111B2044C6BA0003C045 /* Build configuration list for PBXAggregateTarget "Flutter Assemble" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 33CC111C2044C6BA0003C045 /* Debug */, - 33CC111D2044C6BA0003C045 /* Release */, - 338D0CEB231458BD00FA5F75 /* Profile */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = 33CC10E52044A3C60003C045 /* Project object */; -} diff --git a/pkgs/objective_c/example/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/pkgs/objective_c/example/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist deleted file mode 100644 index 18d981003..000000000 --- a/pkgs/objective_c/example/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +++ /dev/null @@ -1,8 +0,0 @@ - - - - - IDEDidComputeMac32BitWarning - - - diff --git a/pkgs/objective_c/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/pkgs/objective_c/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme deleted file mode 100644 index c87f47847..000000000 --- a/pkgs/objective_c/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +++ /dev/null @@ -1,98 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/pkgs/objective_c/example/macos/Runner.xcworkspace/contents.xcworkspacedata b/pkgs/objective_c/example/macos/Runner.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index 21a3cc14c..000000000 --- a/pkgs/objective_c/example/macos/Runner.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - diff --git a/pkgs/objective_c/example/macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/pkgs/objective_c/example/macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist deleted file mode 100644 index 18d981003..000000000 --- a/pkgs/objective_c/example/macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +++ /dev/null @@ -1,8 +0,0 @@ - - - - - IDEDidComputeMac32BitWarning - - - diff --git a/pkgs/objective_c/example/macos/Runner/AppDelegate.swift b/pkgs/objective_c/example/macos/Runner/AppDelegate.swift deleted file mode 100644 index b3c176141..000000000 --- a/pkgs/objective_c/example/macos/Runner/AppDelegate.swift +++ /dev/null @@ -1,13 +0,0 @@ -import Cocoa -import FlutterMacOS - -@main -class AppDelegate: FlutterAppDelegate { - override func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool { - return true - } - - override func applicationSupportsSecureRestorableState(_ app: NSApplication) -> Bool { - return true - } -} diff --git a/pkgs/objective_c/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json b/pkgs/objective_c/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json deleted file mode 100644 index a2ec33f19..000000000 --- a/pkgs/objective_c/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json +++ /dev/null @@ -1,68 +0,0 @@ -{ - "images" : [ - { - "size" : "16x16", - "idiom" : "mac", - "filename" : "app_icon_16.png", - "scale" : "1x" - }, - { - "size" : "16x16", - "idiom" : "mac", - "filename" : "app_icon_32.png", - "scale" : "2x" - }, - { - "size" : "32x32", - "idiom" : "mac", - "filename" : "app_icon_32.png", - "scale" : "1x" - }, - { - "size" : "32x32", - "idiom" : "mac", - "filename" : "app_icon_64.png", - "scale" : "2x" - }, - { - "size" : "128x128", - "idiom" : "mac", - "filename" : "app_icon_128.png", - "scale" : "1x" - }, - { - "size" : "128x128", - "idiom" : "mac", - "filename" : "app_icon_256.png", - "scale" : "2x" - }, - { - "size" : "256x256", - "idiom" : "mac", - "filename" : "app_icon_256.png", - "scale" : "1x" - }, - { - "size" : "256x256", - "idiom" : "mac", - "filename" : "app_icon_512.png", - "scale" : "2x" - }, - { - "size" : "512x512", - "idiom" : "mac", - "filename" : "app_icon_512.png", - "scale" : "1x" - }, - { - "size" : "512x512", - "idiom" : "mac", - "filename" : "app_icon_1024.png", - "scale" : "2x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} diff --git a/pkgs/objective_c/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png b/pkgs/objective_c/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png deleted file mode 100644 index 82b6f9d9a..000000000 Binary files a/pkgs/objective_c/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png and /dev/null differ diff --git a/pkgs/objective_c/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png b/pkgs/objective_c/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png deleted file mode 100644 index 13b35eba5..000000000 Binary files a/pkgs/objective_c/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png and /dev/null differ diff --git a/pkgs/objective_c/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png b/pkgs/objective_c/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png deleted file mode 100644 index 0a3f5fa40..000000000 Binary files a/pkgs/objective_c/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png and /dev/null differ diff --git a/pkgs/objective_c/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png b/pkgs/objective_c/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png deleted file mode 100644 index bdb57226d..000000000 Binary files a/pkgs/objective_c/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png and /dev/null differ diff --git a/pkgs/objective_c/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png b/pkgs/objective_c/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png deleted file mode 100644 index f083318e0..000000000 Binary files a/pkgs/objective_c/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png and /dev/null differ diff --git a/pkgs/objective_c/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png b/pkgs/objective_c/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png deleted file mode 100644 index 326c0e72c..000000000 Binary files a/pkgs/objective_c/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png and /dev/null differ diff --git a/pkgs/objective_c/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png b/pkgs/objective_c/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png deleted file mode 100644 index 2f1632cfd..000000000 Binary files a/pkgs/objective_c/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png and /dev/null differ diff --git a/pkgs/objective_c/example/macos/Runner/Base.lproj/MainMenu.xib b/pkgs/objective_c/example/macos/Runner/Base.lproj/MainMenu.xib deleted file mode 100644 index 80e867a4e..000000000 --- a/pkgs/objective_c/example/macos/Runner/Base.lproj/MainMenu.xib +++ /dev/null @@ -1,343 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/pkgs/objective_c/example/macos/Runner/Configs/AppInfo.xcconfig b/pkgs/objective_c/example/macos/Runner/Configs/AppInfo.xcconfig deleted file mode 100644 index 50d7b8686..000000000 --- a/pkgs/objective_c/example/macos/Runner/Configs/AppInfo.xcconfig +++ /dev/null @@ -1,14 +0,0 @@ -// Application-level settings for the Runner target. -// -// This may be replaced with something auto-generated from metadata (e.g., pubspec.yaml) in the -// future. If not, the values below would default to using the project name when this becomes a -// 'flutter create' template. - -// The application's name. By default this is also the title of the Flutter window. -PRODUCT_NAME = objective_c_example - -// The application's bundle identifier -PRODUCT_BUNDLE_IDENTIFIER = com.github.dartlang.objectiveCExample - -// The copyright displayed in application information -PRODUCT_COPYRIGHT = Copyright © 2024 com.github.dart_lang. All rights reserved. diff --git a/pkgs/objective_c/example/macos/Runner/Configs/Debug.xcconfig b/pkgs/objective_c/example/macos/Runner/Configs/Debug.xcconfig deleted file mode 100644 index 36b0fd946..000000000 --- a/pkgs/objective_c/example/macos/Runner/Configs/Debug.xcconfig +++ /dev/null @@ -1,2 +0,0 @@ -#include "../../Flutter/Flutter-Debug.xcconfig" -#include "Warnings.xcconfig" diff --git a/pkgs/objective_c/example/macos/Runner/Configs/Release.xcconfig b/pkgs/objective_c/example/macos/Runner/Configs/Release.xcconfig deleted file mode 100644 index dff4f4956..000000000 --- a/pkgs/objective_c/example/macos/Runner/Configs/Release.xcconfig +++ /dev/null @@ -1,2 +0,0 @@ -#include "../../Flutter/Flutter-Release.xcconfig" -#include "Warnings.xcconfig" diff --git a/pkgs/objective_c/example/macos/Runner/Configs/Warnings.xcconfig b/pkgs/objective_c/example/macos/Runner/Configs/Warnings.xcconfig deleted file mode 100644 index 42bcbf478..000000000 --- a/pkgs/objective_c/example/macos/Runner/Configs/Warnings.xcconfig +++ /dev/null @@ -1,13 +0,0 @@ -WARNING_CFLAGS = -Wall -Wconditional-uninitialized -Wnullable-to-nonnull-conversion -Wmissing-method-return-type -Woverlength-strings -GCC_WARN_UNDECLARED_SELECTOR = YES -CLANG_UNDEFINED_BEHAVIOR_SANITIZER_NULLABILITY = YES -CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE -CLANG_WARN__DUPLICATE_METHOD_MATCH = YES -CLANG_WARN_PRAGMA_PACK = YES -CLANG_WARN_STRICT_PROTOTYPES = YES -CLANG_WARN_COMMA = YES -GCC_WARN_STRICT_SELECTOR_MATCH = YES -CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = YES -CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES -GCC_WARN_SHADOW = YES -CLANG_WARN_UNREACHABLE_CODE = YES diff --git a/pkgs/objective_c/example/macos/Runner/DebugProfile.entitlements b/pkgs/objective_c/example/macos/Runner/DebugProfile.entitlements deleted file mode 100644 index dddb8a30c..000000000 --- a/pkgs/objective_c/example/macos/Runner/DebugProfile.entitlements +++ /dev/null @@ -1,12 +0,0 @@ - - - - - com.apple.security.app-sandbox - - com.apple.security.cs.allow-jit - - com.apple.security.network.server - - - diff --git a/pkgs/objective_c/example/macos/Runner/Info.plist b/pkgs/objective_c/example/macos/Runner/Info.plist deleted file mode 100644 index 4789daa6a..000000000 --- a/pkgs/objective_c/example/macos/Runner/Info.plist +++ /dev/null @@ -1,32 +0,0 @@ - - - - - CFBundleDevelopmentRegion - $(DEVELOPMENT_LANGUAGE) - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIconFile - - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - APPL - CFBundleShortVersionString - $(FLUTTER_BUILD_NAME) - CFBundleVersion - $(FLUTTER_BUILD_NUMBER) - LSMinimumSystemVersion - $(MACOSX_DEPLOYMENT_TARGET) - NSHumanReadableCopyright - $(PRODUCT_COPYRIGHT) - NSMainNibFile - MainMenu - NSPrincipalClass - NSApplication - - diff --git a/pkgs/objective_c/example/macos/Runner/MainFlutterWindow.swift b/pkgs/objective_c/example/macos/Runner/MainFlutterWindow.swift deleted file mode 100644 index 3cc05eb23..000000000 --- a/pkgs/objective_c/example/macos/Runner/MainFlutterWindow.swift +++ /dev/null @@ -1,15 +0,0 @@ -import Cocoa -import FlutterMacOS - -class MainFlutterWindow: NSWindow { - override func awakeFromNib() { - let flutterViewController = FlutterViewController() - let windowFrame = self.frame - self.contentViewController = flutterViewController - self.setFrame(windowFrame, display: true) - - RegisterGeneratedPlugins(registry: flutterViewController) - - super.awakeFromNib() - } -} diff --git a/pkgs/objective_c/example/macos/Runner/Release.entitlements b/pkgs/objective_c/example/macos/Runner/Release.entitlements deleted file mode 100644 index 852fa1a47..000000000 --- a/pkgs/objective_c/example/macos/Runner/Release.entitlements +++ /dev/null @@ -1,8 +0,0 @@ - - - - - com.apple.security.app-sandbox - - - diff --git a/pkgs/objective_c/example/macos/RunnerTests/RunnerTests.swift b/pkgs/objective_c/example/macos/RunnerTests/RunnerTests.swift deleted file mode 100644 index 61f3bd1fc..000000000 --- a/pkgs/objective_c/example/macos/RunnerTests/RunnerTests.swift +++ /dev/null @@ -1,12 +0,0 @@ -import Cocoa -import FlutterMacOS -import XCTest - -class RunnerTests: XCTestCase { - - func testExample() { - // If you add code to the Runner application, consider adding tests here. - // See https://developer.apple.com/documentation/xctest for more information about using XCTest. - } - -} diff --git a/pkgs/objective_c/example/pubspec.yaml b/pkgs/objective_c/example/pubspec.yaml index 8395b9bc6..7ff218f53 100644 --- a/pkgs/objective_c/example/pubspec.yaml +++ b/pkgs/objective_c/example/pubspec.yaml @@ -1,27 +1,15 @@ -# Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file -# for details. All rights reserved. Use of this source code is governed by a -# BSD-style license that can be found in the LICENSE file. - name: example description: "Demonstrates using package:objective_c" -publish_to: 'none' -version: 0.1.0 +version: 1.0.0 +publish_to: none environment: - sdk: '>=3.8.0 <4.0.0' - flutter: '>=3.32.0' + sdk: '>=3.9.0-21.0.dev <4.0.0' dependencies: - ffi: ^2.1.0 - flutter: - sdk: flutter objective_c: path: .. dev_dependencies: - flutter_test: - sdk: flutter - flutter_lints: ^3.0.0 - -flutter: - uses-material-design: true + lints: ^5.0.0 + test: ^1.24.0 diff --git a/pkgs/objective_c/ffigen_c.yaml b/pkgs/objective_c/ffigen_c.yaml index 779f01edf..5db1ba35d 100644 --- a/pkgs/objective_c/ffigen_c.yaml +++ b/pkgs/objective_c/ffigen_c.yaml @@ -6,28 +6,20 @@ headers: entry-points: - 'src/include/dart_api_dl.h' - 'src/objective_c.h' - - 'src/objective_c_runtime.h' - 'src/os_version.h' ffi-native: - assetId: 'objective_c.framework/objective_c' + asset-id: 'package:objective_c/objective_c.dylib' exclude-all-by-default: true generate-for-package-objective-c: true sort: true functions: include: - - 'objc_.*' - - 'object_getClass' - - 'sel_registerName' - - 'sel_getName' - - 'protocol_getMethodDescription' - - 'protocol_getName' - 'newFinalizableHandle' - 'DOBJC_.*' leaf: include: - '.*' exclude: - - 'objc_msgSend.*' - 'DOBJC_deleteFinalizableHandle' - 'DOBJC_disposeObjCBlockWithClosure' - 'DOBJC_newFinalizableBool' @@ -35,31 +27,11 @@ functions: - 'DOBJC_awaitWaiter' rename: 'DOBJC_(.*)': '$1' - 'sel_registerName': 'registerName' - 'sel_getName': 'getName' - 'objc_getClass': 'getClass' - 'objc_retain': 'objectRetain' - 'objc_retainBlock': 'blockRetain' - 'objc_release': 'objectRelease' - 'objc_autorelease': 'objectAutorelease' - 'objc_msgSend': 'msgSend' - 'objc_msgSend_fpret': 'msgSendFpret' - 'objc_msgSend_stret': 'msgSendStret' - 'object_getClass': 'getObjectClass' - 'objc_copyClassList': 'copyClassList' - 'objc_getProtocol': 'getProtocol' - 'protocol_getMethodDescription': 'getMethodDescription' - 'protocol_getName': 'getProtocolName' -globals: - include: - - '_NSConcrete.*Block' - rename: - '_(.*)': '$1' typedefs: include: - 'Dart_FinalizableHandle' structs: - include : + include: - '_DOBJC_Context' rename: '_ObjC(.*)': 'ObjC$1' @@ -73,7 +45,7 @@ preamble: | // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. - // Bindings for `src/objective_c.h` and `src/objective_c_runtime.h`. + // Bindings for `src/objective_c.h` etc. // Regenerate bindings with `dart run tool/generate_code.dart`. // ignore_for_file: always_specify_types diff --git a/pkgs/objective_c/ffigen_objc.yaml b/pkgs/objective_c/ffigen_objc.yaml index 672999521..ed3bd43bd 100644 --- a/pkgs/objective_c/ffigen_objc.yaml +++ b/pkgs/objective_c/ffigen_objc.yaml @@ -13,10 +13,13 @@ headers: - 'src/observer.h' - 'src/protocol.h' ffi-native: + asset-id: 'package:objective_c/objective_c.dylib' exclude-all-by-default: true include-transitive-objc-categories: false generate-for-package-objective-c: true sort: true +library-imports: + collection: 'dart:collection' external-versions: # See https://docs.flutter.dev/reference/supported-platforms. ios: @@ -158,14 +161,6 @@ enums: - NSURLBookmarkCreationOptions - NSURLBookmarkResolutionOptions - NSURLHandleStatus -globals: - include: - - NSKeyValueChangeIndexesKey - - NSKeyValueChangeKindKey - - NSKeyValueChangeNewKey - - NSKeyValueChangeNotificationIsPriorKey - - NSKeyValueChangeOldKey - - NSLocalizedDescriptionKey typedefs: include: - 'CFStringRef' @@ -174,7 +169,7 @@ preamble: | // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. - // Bindings for `src/foundation.h`. + // Bindings for package:objective_c's ObjC code and the Foundation framework. // Regenerate bindings with `dart run tool/generate_code.dart`. // ignore_for_file: always_specify_types @@ -184,4 +179,3 @@ preamble: | // ignore_for_file: unused_element // ignore_for_file: unused_field // coverage:ignore-file - import 'dart:collection'; diff --git a/pkgs/objective_c/ffigen_runtime.yaml b/pkgs/objective_c/ffigen_runtime.yaml new file mode 100644 index 000000000..fe88ffbaf --- /dev/null +++ b/pkgs/objective_c/ffigen_runtime.yaml @@ -0,0 +1,69 @@ +# Generate bindings for the ObjC runtime headers. +# Regenerate bindings with `dart run tool/generate_code.dart`. +name: RuntimeBindings +output: 'lib/src/runtime_bindings_generated.dart' +headers: + entry-points: + - 'src/objective_c_runtime.h' +ffi-native: +exclude-all-by-default: true +generate-for-package-objective-c: true +sort: true +functions: + include: + - 'objc_.*' + - 'object_getClass' + - 'sel_registerName' + - 'sel_getName' + - 'protocol_getMethodDescription' + - 'protocol_getName' + leaf: + include: + - '.*' + exclude: + - 'objc_msgSend.*' + rename: + 'sel_registerName': 'registerName' + 'sel_getName': 'getName' + 'objc_getClass': 'getClass' + 'objc_retain': 'objectRetain' + 'objc_retainBlock': 'blockRetain' + 'objc_release': 'objectRelease' + 'objc_autorelease': 'objectAutorelease' + 'objc_msgSend': 'msgSend' + 'objc_msgSend_fpret': 'msgSendFpret' + 'objc_msgSend_stret': 'msgSendStret' + 'object_getClass': 'getObjectClass' + 'objc_copyClassList': 'copyClassList' + 'objc_getProtocol': 'getProtocol' + 'protocol_getMethodDescription': 'getMethodDescription' + 'protocol_getName': 'getProtocolName' +globals: + include: + - '_NSConcrete.*Block' + - NSKeyValueChangeIndexesKey + - NSKeyValueChangeKindKey + - NSKeyValueChangeNewKey + - NSKeyValueChangeNotificationIsPriorKey + - NSKeyValueChangeOldKey + - NSLocalizedDescriptionKey + rename: + '_(.*)': '$1' +structs: + include: + - '_ObjC.*' + rename: + '_ObjC(.*)': 'ObjC$1' +preamble: | + // Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file + // for details. All rights reserved. Use of this source code is governed by a + // BSD-style license that can be found in the LICENSE file. + + // Bindings for `src/objective_c_runtime.h`. + // Regenerate bindings with `dart run tool/generate_code.dart`. + + // ignore_for_file: always_specify_types + // ignore_for_file: camel_case_types + // ignore_for_file: non_constant_identifier_names + // ignore_for_file: unused_element + // coverage:ignore-file diff --git a/pkgs/objective_c/hook/build.dart b/pkgs/objective_c/hook/build.dart new file mode 100644 index 000000000..539ee2a9c --- /dev/null +++ b/pkgs/objective_c/hook/build.dart @@ -0,0 +1,124 @@ +// Copyright (c) 2025, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:io'; + +import 'package:code_assets/code_assets.dart'; +import 'package:hooks/hooks.dart'; +import 'package:logging/logging.dart'; +import 'package:native_toolchain_c/src/cbuilder/compiler_resolver.dart'; + +const objCFlags = ['-x', 'objective-c', '-fobjc-arc']; + +const assetName = 'objective_c.dylib'; + +// TODO(https://github.com/dart-lang/native/issues/2272): Remove this from the +// main build. +const extraCFiles = ['test/util.c']; + +final logger = Logger('') + ..level = Level.INFO + ..onRecord.listen((record) { + print('${record.level.name}: ${record.time}: ${record.message}'); + }); + +void main(List args) async { + await build(args, (input, output) async { + const supportedOSs = {OS.iOS, OS.macOS}; + if (!supportedOSs.contains(input.config.code.targetOS)) { + // Nothing to do. + return; + } + + if (input.config.code.linkModePreference == LinkModePreference.static) { + throw UnsupportedError('LinkModePreference.static is not supported.'); + } + + final packageName = input.packageName; + final assetPath = input.outputDirectory.resolve(assetName); + final srcDir = Directory.fromUri(input.packageRoot.resolve('src/')); + + final cFiles = []; + final mFiles = []; + final hFiles = []; + for (final file in srcDir.listSync(recursive: true)) { + if (file is File) { + final path = file.path; + if (path.endsWith('.c')) cFiles.add(path); + if (path.endsWith('.m')) mFiles.add(path); + if (path.endsWith('.h')) hFiles.add(path); + } + } + + cFiles.addAll(extraCFiles.map((f) => input.packageRoot.resolve(f).path)); + + final cFlags = []; + final mFlags = [...cFlags, ...objCFlags]; + + final builder = await Builder.create(input, input.packageRoot.path); + + final objectFiles = await Future.wait(>[ + for (final src in cFiles) builder.buildObject(src, cFlags), + for (final src in mFiles) builder.buildObject(src, mFlags), + ]); + await builder.linkLib(objectFiles, assetPath.toFilePath()); + + output.addDependencies(cFiles.map(Uri.file)); + output.addDependencies(mFiles.map(Uri.file)); + output.addDependencies(hFiles.map(Uri.file)); + + output.assets.code.add( + CodeAsset( + package: packageName, + name: assetName, + file: assetPath, + linkMode: DynamicLoadingBundled(), + ), + ); + }); +} + +class Builder { + final String _comp; + final String _rootDir; + final Uri _tempOutDir; + Builder._(this._comp, this._rootDir, this._tempOutDir); + + static Future create(BuildInput input, String rootDir) async { + final resolver = CompilerResolver( + codeConfig: input.config.code, + logger: logger, + ); + return Builder._( + (await resolver.resolveCompiler()).uri.toFilePath(), + rootDir, + input.outputDirectory.resolve('obj/'), + ); + } + + Future buildObject(String input, List flags) async { + assert(input.startsWith(_rootDir)); + final relativeInput = input.substring(_rootDir.length); + final output = '${_tempOutDir.resolve(relativeInput).path}.o'; + File(output).parent.createSync(recursive: true); + await _compile([...flags, '-c', input, '-fpic', '-I', 'src'], output); + return output; + } + + Future linkLib(List objects, String output) => + _compile(['-shared', '-undefined', 'dynamic_lookup', ...objects], output); + + Future _compile(List flags, String output) async { + final args = [...flags, '-o', output]; + logger.info('Running: $_comp ${args.join(" ")}'); + final proc = await Process.run(_comp, args); + logger.info(proc.stdout); + logger.info(proc.stderr); + if (proc.exitCode != 0) { + exitCode = proc.exitCode; + throw Exception('Command failed: $_comp ${args.join(" ")}'); + } + logger.info('Generated $output'); + } +} diff --git a/pkgs/objective_c/ios/Classes/objective_c.c b/pkgs/objective_c/ios/Classes/objective_c.c deleted file mode 100644 index 6d9c021cc..000000000 --- a/pkgs/objective_c/ios/Classes/objective_c.c +++ /dev/null @@ -1,8 +0,0 @@ -// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file -// for details. All rights reserved. Use of this source code is governed by a -// BSD-style license that can be found in the LICENSE file. - -// Relative import to be able to reuse the C sources. -// See the comment in ../objective_c.podspec for more information. -#include "../../src/objective_c.c" -#include "../../src/include/dart_api_dl.c" diff --git a/pkgs/objective_c/ios/Classes/objective_c.m b/pkgs/objective_c/ios/Classes/objective_c.m deleted file mode 100644 index b3ce4fb15..000000000 --- a/pkgs/objective_c/ios/Classes/objective_c.m +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file -// for details. All rights reserved. Use of this source code is governed by a -// BSD-style license that can be found in the LICENSE file. - -// Relative import to be able to reuse the ObjC sources. -// See the comment in ../objective_c.podspec for more information. -#include "../../src/input_stream_adapter.m" -#include "../../src/objective_c.m" -#include "../../src/objective_c_bindings_generated.m" -#include "../../src/observer.m" -#include "../../src/protocol.m" diff --git a/pkgs/objective_c/ios/objective_c.podspec b/pkgs/objective_c/ios/objective_c.podspec deleted file mode 100644 index e784ccd7c..000000000 --- a/pkgs/objective_c/ios/objective_c.podspec +++ /dev/null @@ -1,28 +0,0 @@ -# -# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html. -# Run `pod lib lint objective_c.podspec` to validate before publishing. -# -Pod::Spec.new do |s| - s.name = 'objective_c' - s.version = '0.0.1' - s.summary = 'A library to access Objective C from Flutter that acts as a support library for package:ffigen.' - s.description = <<-DESC -A library to access Objective C from Flutter that acts as a support library for package:ffigen. - DESC - s.homepage = 'http://example.com' - s.license = { :file => '../LICENSE' } - s.author = { 'Your Company' => 'email@example.com' } - - # This will ensure the source files in Classes/ are included in the native - # builds of apps using this FFI plugin. Podspec does not support relative - # paths, so Classes contains a forwarder C file that relatively imports - # `../src/*` so that the C sources can be shared among all target platforms. - s.source = { :path => '.' } - s.source_files = 'Classes/**/*' - s.dependency 'Flutter' - s.platform = :ios, '12.0' - - # Flutter.framework does not contain a i386 slice. - s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES', 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'i386' } - s.swift_version = '5.0' -end diff --git a/pkgs/objective_c/lib/objective_c.dart b/pkgs/objective_c/lib/objective_c.dart index 02b661d84..573a6893a 100644 --- a/pkgs/objective_c/lib/objective_c.dart +++ b/pkgs/objective_c/lib/objective_c.dart @@ -10,16 +10,10 @@ export 'src/c_bindings_generated.dart' Dart_FinalizableHandle_, ObjCBlockDesc, ObjCBlockImpl, - ObjCMethodDesc, - ObjCObject, - ObjCProtocol, - ObjCSelector, - blockRetain, - objectRelease, - objectRetain, signalWaiter; export 'src/cf_string.dart'; export 'src/converter.dart'; +export 'src/globals.dart'; export 'src/internal.dart' hide blockHasRegisteredClosure, isValidBlock, isValidClass, isValidObject; export 'src/ns_data.dart'; @@ -29,7 +23,17 @@ export 'src/ns_mutable_data.dart'; export 'src/ns_number.dart'; export 'src/ns_string.dart'; export 'src/objective_c_bindings_exported.dart'; +export 'src/objective_c_bindings_generated.dart'; export 'src/observer.dart'; export 'src/os_version.dart'; export 'src/protocol_builder.dart'; +export 'src/runtime_bindings_generated.dart' + show + ObjCMethodDesc, + ObjCObject, + ObjCProtocol, + ObjCSelector, + blockRetain, + objectRelease, + objectRetain; export 'src/selector.dart'; diff --git a/pkgs/objective_c/lib/src/c_bindings_generated.dart b/pkgs/objective_c/lib/src/c_bindings_generated.dart index a14b277ac..5a52f8c0b 100644 --- a/pkgs/objective_c/lib/src/c_bindings_generated.dart +++ b/pkgs/objective_c/lib/src/c_bindings_generated.dart @@ -2,7 +2,7 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -// Bindings for `src/objective_c.h` and `src/objective_c_runtime.h`. +// Bindings for `src/objective_c.h` etc. // Regenerate bindings with `dart run tool/generate_code.dart`. // ignore_for_file: always_specify_types @@ -15,51 +15,16 @@ // // Generated by `package:ffigen`. // ignore_for_file: type=lint -@ffi.DefaultAsset('objective_c.framework/objective_c') +@ffi.DefaultAsset('package:objective_c/objective_c.dylib') library; import 'dart:ffi' as ffi; -@ffi.Array.multi([32]) -@ffi.Native>>(symbol: '_NSConcreteAutoBlock') -external ffi.Array> NSConcreteAutoBlock; - -@ffi.Array.multi([32]) -@ffi.Native>>( - symbol: '_NSConcreteFinalizingBlock', -) -external ffi.Array> NSConcreteFinalizingBlock; - -@ffi.Array.multi([32]) -@ffi.Native>>(symbol: '_NSConcreteGlobalBlock') -external ffi.Array> NSConcreteGlobalBlock; - -@ffi.Array.multi([32]) -@ffi.Native>>(symbol: '_NSConcreteMallocBlock') -external ffi.Array> NSConcreteMallocBlock; - -@ffi.Array.multi([32]) -@ffi.Native>>(symbol: '_NSConcreteStackBlock') -external ffi.Array> NSConcreteStackBlock; - @ffi.Native)>( symbol: 'DOBJC_awaitWaiter', ) external void awaitWaiter(ffi.Pointer waiter); -@ffi.Native Function(ffi.Pointer)>( - symbol: 'objc_retainBlock', - isLeaf: true, -) -external ffi.Pointer blockRetain(ffi.Pointer object); - -@ffi.Native< - ffi.Pointer> Function(ffi.Pointer) ->(symbol: 'objc_copyClassList', isLeaf: true) -external ffi.Pointer> copyClassList( - ffi.Pointer count, -); - @ffi.Native( symbol: 'DOBJC_deleteFinalizableHandle', ) @@ -81,55 +46,10 @@ external ffi.Pointer fillContext( ffi.Pointer context, ); -@ffi.Native Function(ffi.Pointer)>( - symbol: 'objc_getClass', - isLeaf: true, -) -external ffi.Pointer getClass(ffi.Pointer name); - -@ffi.Native< - ObjCMethodDesc Function( - ffi.Pointer, - ffi.Pointer, - ffi.Bool, - ffi.Bool, - ) ->(symbol: 'protocol_getMethodDescription', isLeaf: true) -external ObjCMethodDesc getMethodDescription( - ffi.Pointer protocol, - ffi.Pointer sel, - bool isRequiredMethod, - bool isInstanceMethod, -); - -@ffi.Native Function(ffi.Pointer)>( - symbol: 'sel_getName', - isLeaf: true, -) -external ffi.Pointer getName(ffi.Pointer sel); - -@ffi.Native Function(ffi.Pointer)>( - symbol: 'object_getClass', - isLeaf: true, -) -external ffi.Pointer getObjectClass(ffi.Pointer object); - /// Returns the MacOS/iOS version we're running on. @ffi.Native<_Version Function()>(symbol: 'DOBJC_getOsVesion', isLeaf: true) external _Version getOsVesion(); -@ffi.Native Function(ffi.Pointer)>( - symbol: 'objc_getProtocol', - isLeaf: true, -) -external ffi.Pointer getProtocol(ffi.Pointer name); - -@ffi.Native Function(ffi.Pointer)>( - symbol: 'protocol_getName', - isLeaf: true, -) -external ffi.Pointer getProtocolName(ffi.Pointer proto); - @ffi.Native)>( symbol: 'DOBJC_initializeApi', isLeaf: true, @@ -142,15 +62,6 @@ external int initializeApi(ffi.Pointer data); ) external bool isValidBlock(ffi.Pointer block); -@ffi.Native(symbol: 'objc_msgSend') -external void msgSend(); - -@ffi.Native(symbol: 'objc_msgSend_fpret') -external void msgSendFpret(); - -@ffi.Native(symbol: 'objc_msgSend_stret') -external void msgSendStret(); - @ffi.Native Function(ffi.Handle)>( symbol: 'DOBJC_newFinalizableBool', ) @@ -170,32 +81,6 @@ external Dart_FinalizableHandle newFinalizableHandle( ) external ffi.Pointer newWaiter(); -@ffi.Native Function(ffi.Pointer)>( - symbol: 'objc_autorelease', - isLeaf: true, -) -external ffi.Pointer objectAutorelease( - ffi.Pointer object, -); - -@ffi.Native)>( - symbol: 'objc_release', - isLeaf: true, -) -external void objectRelease(ffi.Pointer object); - -@ffi.Native Function(ffi.Pointer)>( - symbol: 'objc_retain', - isLeaf: true, -) -external ffi.Pointer objectRetain(ffi.Pointer object); - -@ffi.Native Function(ffi.Pointer)>( - symbol: 'sel_registerName', - isLeaf: true, -) -external ffi.Pointer registerName(ffi.Pointer name); - @ffi.Native< ffi.Void Function( ffi.Pointer)>>, @@ -288,20 +173,12 @@ final class ObjCBlockImpl extends ffi.Struct { @ffi.Int64() external int dispose_port; -} -final class ObjCMethodDesc extends ffi.Struct { - external ffi.Pointer name; - - external ffi.Pointer types; + external ffi.Pointer trampoline; } final class ObjCObject extends ffi.Opaque {} -final class ObjCProtocol extends ffi.Opaque {} - -final class ObjCSelector extends ffi.Opaque {} - final class _Dart_Isolate extends ffi.Opaque {} final class _Version extends ffi.Struct { diff --git a/pkgs/objective_c/lib/src/globals.dart b/pkgs/objective_c/lib/src/globals.dart new file mode 100644 index 000000000..65fa8c71a --- /dev/null +++ b/pkgs/objective_c/lib/src/globals.dart @@ -0,0 +1,43 @@ +// Copyright (c) 2025, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'objective_c_bindings_generated.dart'; +import 'runtime_bindings_generated.dart' as r; + + +NSString get NSKeyValueChangeIndexesKey => NSString.castFromPointer( + r.NSKeyValueChangeIndexesKey, + retain: true, + release: true, +); + +NSString get NSKeyValueChangeKindKey => NSString.castFromPointer( + r.NSKeyValueChangeKindKey, + retain: true, + release: true, +); + +NSString get NSKeyValueChangeNewKey => NSString.castFromPointer( + r.NSKeyValueChangeNewKey, + retain: true, + release: true, +); + +NSString get NSKeyValueChangeNotificationIsPriorKey => NSString.castFromPointer( + r.NSKeyValueChangeNotificationIsPriorKey, + retain: true, + release: true, +); + +NSString get NSKeyValueChangeOldKey => NSString.castFromPointer( + r.NSKeyValueChangeOldKey, + retain: true, + release: true, +); + +NSString get NSLocalizedDescriptionKey => NSString.castFromPointer( + r.NSLocalizedDescriptionKey, + retain: true, + release: true, +); diff --git a/pkgs/objective_c/lib/src/internal.dart b/pkgs/objective_c/lib/src/internal.dart index b6507c6c2..b26b67cf3 100644 --- a/pkgs/objective_c/lib/src/internal.dart +++ b/pkgs/objective_c/lib/src/internal.dart @@ -8,8 +8,9 @@ import 'dart:isolate'; import 'package:ffi/ffi.dart'; import 'c_bindings_generated.dart' as c; +import 'runtime_bindings_generated.dart' as r; -typedef ObjectPtr = Pointer; +typedef ObjectPtr = Pointer; typedef BlockPtr = Pointer; typedef VoidPtr = Pointer; @@ -77,23 +78,25 @@ final class ObjCRuntimeError extends Error { String toString() => '$runtimeType: $message'; } -extension GetProtocolName on Pointer { +extension GetProtocolName on Pointer { /// Returns the name of the protocol. - String get name => c.getProtocolName(this).cast().toDartString(); + String get name => r.getProtocolName(this).cast().toDartString(); } /// Only for use by ffigen bindings. -Pointer registerName(String name) { +Pointer registerName(String name) { + _ensureDartAPI(); final cstr = name.toNativeUtf8(); - final sel = c.registerName(cstr.cast()); + final sel = r.registerName(cstr.cast()); calloc.free(cstr); return sel; } /// Only for use by ffigen bindings. ObjectPtr getClass(String name) { + _ensureDartAPI(); final cstr = name.toNativeUtf8(); - final clazz = c.getClass(cstr.cast()); + final clazz = r.getClass(cstr.cast()); calloc.free(cstr); if (clazz == nullptr) { throw FailedToLoadClassException(name); @@ -102,9 +105,10 @@ ObjectPtr getClass(String name) { } /// Only for use by ffigen bindings. -Pointer getProtocol(String name) { +Pointer getProtocol(String name) { + _ensureDartAPI(); final cstr = name.toNativeUtf8(); - final clazz = c.getProtocol(cstr.cast()); + final clazz = r.getProtocol(cstr.cast()); calloc.free(cstr); if (clazz == nullptr) { throw FailedToLoadProtocolException(name); @@ -114,12 +118,13 @@ Pointer getProtocol(String name) { /// Only for use by ffigen bindings. Pointer? getProtocolMethodSignature( - Pointer protocol, - Pointer sel, { + Pointer protocol, + Pointer sel, { required bool isRequired, required bool isInstanceMethod, }) { - final sig = c + _ensureDartAPI(); + final sig = r .getMethodDescription(protocol, sel, isRequired, isInstanceMethod) .types; return sig == nullptr ? null : sig; @@ -127,17 +132,17 @@ Pointer? getProtocolMethodSignature( /// Only for use by ffigen bindings. final msgSendPointer = Native.addressOf>( - c.msgSend, + r.msgSend, ); /// Only for use by ffigen bindings. final msgSendFpretPointer = Native.addressOf>( - c.msgSendFpret, + r.msgSendFpret, ); /// Only for use by ffigen bindings. final msgSendStretPointer = Native.addressOf>( - c.msgSendStret, + r.msgSendStret, ); /// Only for use by ffigen bindings. @@ -145,7 +150,7 @@ final useMsgSendVariants = Abi.current() == Abi.iosX64 || Abi.current() == Abi.macosX64; /// Only for use by ffigen bindings. -bool respondsToSelector(ObjectPtr obj, Pointer sel) => +bool respondsToSelector(ObjectPtr obj, Pointer sel) => _objcMsgSendRespondsToSelector(obj, _selRespondsToSelector, sel); final _selRespondsToSelector = registerName('respondsToSelector:'); final _objcMsgSendRespondsToSelector = msgSendPointer @@ -153,13 +158,13 @@ final _objcMsgSendRespondsToSelector = msgSendPointer NativeFunction< Bool Function( ObjectPtr, - Pointer, - Pointer aSelector, + Pointer, + Pointer aSelector, ) > >() .asFunction< - bool Function(ObjectPtr, Pointer, Pointer) + bool Function(ObjectPtr, Pointer, Pointer) >(); // _FinalizablePointer exists because we can't access `this` in the initializers @@ -227,10 +232,10 @@ abstract final class _ObjCReference _isReleased.value = true; } - void release() => _release(c.objectRelease); + void release() => _release(r.objectRelease); Pointer autorelease() { - _release(c.objectAutorelease); + _release(r.objectAutorelease); return _finalizable.ptr; } @@ -258,7 +263,7 @@ abstract final class _ObjCReference Pointer retainAndAutorelease() { final ptr = pointer; _retain(ptr); - c.objectAutorelease(ptr.cast()); + r.objectAutorelease(ptr.cast()); return ptr; } @@ -282,19 +287,19 @@ class _ObjCRefHolder> { } @pragma('vm:deeply-immutable') -final class ObjCObjectRef extends _ObjCReference { +final class ObjCObjectRef extends _ObjCReference { ObjCObjectRef(ObjectPtr ptr, {required super.retain, required super.release}) : super(_FinalizablePointer(ptr)); @override - void _retain(ObjectPtr ptr) => c.objectRetain(ptr); + void _retain(ObjectPtr ptr) => r.objectRetain(ptr); @override bool _isValid(ObjectPtr ptr) => _isValidObject(ptr); } /// Only for use by ffigen bindings. -class ObjCObjectBase extends _ObjCRefHolder { +class ObjCObjectBase extends _ObjCRefHolder { ObjCObjectBase(ObjectPtr ptr, {required bool retain, required bool release}) : super(ObjCObjectRef(ptr, retain: retain, release: release)); } @@ -303,7 +308,7 @@ class ObjCObjectBase extends _ObjCRefHolder { // readable memory, or be null. May (rarely) return false positives. bool _isValidObject(ObjectPtr ptr) { if (ptr == nullptr) return false; - return _isValidClass(c.getObjectClass(ptr)); + return _isValidClass(r.getObjectClass(ptr)); } final _allClasses = {}; @@ -318,7 +323,7 @@ bool _isValidClass(ObjectPtr clazz, {bool forceReloadClasses = false}) { // enabled, and only happens more than O(1) times if there are actually // invalid objects in use, which shouldn't happen in correct code. final countPtr = calloc(); - final classList = c.copyClassList(countPtr); + final classList = r.copyClassList(countPtr); final count = countPtr.value; calloc.free(countPtr); _allClasses.clear(); @@ -341,7 +346,7 @@ final class ObjCBlockRef extends _ObjCReference { : super(_FinalizablePointer(ptr)); @override - void _retain(BlockPtr ptr) => c.blockRetain(ptr.cast()); + void _retain(BlockPtr ptr) => r.blockRetain(ptr.cast()); @override bool _isValid(BlockPtr ptr) => c.isValidBlock(ptr); @@ -375,24 +380,26 @@ final _closureBlockDesc = _newBlockDesc( BlockPtr _newBlock( VoidPtr invoke, VoidPtr target, + VoidPtr trampoline, Pointer descriptor, int disposePort, int flags, ) { final b = calloc.allocate(sizeOf()); - b.ref.isa = Native.addressOf>(c.NSConcreteGlobalBlock).cast(); + b.ref.isa = Native.addressOf>(r.NSConcreteGlobalBlock).cast(); b.ref.flags = flags; b.ref.reserved = 0; b.ref.invoke = invoke; b.ref.target = target; b.ref.dispose_port = disposePort; b.ref.descriptor = descriptor; + b.ref.trampoline = trampoline; assert(c.isValidBlock(b)); - final copy = c.blockRetain(b.cast()).cast(); + final copy = r.blockRetain(b.cast()).cast(); calloc.free(b); assert( copy.ref.isa == - Native.addressOf>(c.NSConcreteMallocBlock).cast(), + Native.addressOf>(r.NSConcreteMallocBlock).cast(), ); assert(c.isValidBlock(copy)); return copy; @@ -401,10 +408,12 @@ BlockPtr _newBlock( const int _blockHasCopyDispose = 1 << 25; /// Only for use by ffigen bindings. -BlockPtr newClosureBlock(VoidPtr invoke, Function fn, bool keepIsolateAlive) => +BlockPtr newClosureBlock(VoidPtr invoke, Function fn, bool keepIsolateAlive, + {VoidPtr? trampoline}) => _newBlock( invoke, _registerBlockClosure(fn, keepIsolateAlive), + trampoline ?? nullptr, _closureBlockDesc, _blockClosureDisposer.sendPort.nativePort, _blockHasCopyDispose, @@ -412,7 +421,7 @@ BlockPtr newClosureBlock(VoidPtr invoke, Function fn, bool keepIsolateAlive) => /// Only for use by ffigen bindings. BlockPtr newPointerBlock(VoidPtr invoke, VoidPtr target) => - _newBlock(invoke, target, _pointerBlockDesc, 0, 0); + _newBlock(invoke, nullptr, target, _pointerBlockDesc, 0, 0); typedef _RegEntry = ({Function closure, RawReceivePort? keepAlivePort}); diff --git a/pkgs/objective_c/lib/src/ns_input_stream.dart b/pkgs/objective_c/lib/src/ns_input_stream.dart index 8fd8ec742..795253999 100644 --- a/pkgs/objective_c/lib/src/ns_input_stream.dart +++ b/pkgs/objective_c/lib/src/ns_input_stream.dart @@ -2,6 +2,7 @@ import 'dart:async'; import 'dart:ffi'; import 'dart:isolate'; +import 'globals.dart'; import 'ns_data.dart'; import 'ns_string.dart'; import 'objective_c_bindings_generated.dart'; diff --git a/pkgs/objective_c/lib/src/ns_string.dart b/pkgs/objective_c/lib/src/ns_string.dart index 552b418e5..ca25a11a7 100644 --- a/pkgs/objective_c/lib/src/ns_string.dart +++ b/pkgs/objective_c/lib/src/ns_string.dart @@ -3,6 +3,7 @@ // BSD-style license that can be found in the LICENSE file. import 'package:ffi/ffi.dart'; + import 'objective_c_bindings_generated.dart'; extension StringToNSString on String { diff --git a/pkgs/objective_c/lib/src/objective_c_bindings_exported.dart b/pkgs/objective_c/lib/src/objective_c_bindings_exported.dart index 0fabfe30f..49a882fa9 100644 --- a/pkgs/objective_c/lib/src/objective_c_bindings_exported.dart +++ b/pkgs/objective_c/lib/src/objective_c_bindings_exported.dart @@ -12,6 +12,8 @@ export 'objective_c_bindings_generated.dart' CGPoint, CGRect, CGSize, + DOBJCObservation, + DartInputStreamAdapter, DartProtocol, DartProtocolBuilder, NSAppleEventSendOptions, @@ -61,17 +63,11 @@ export 'objective_c_bindings_generated.dart' NSItemProviderRepresentationVisibility, NSItemProviderWriting, NSKeyValueChange, - NSKeyValueChangeIndexesKey, - NSKeyValueChangeKindKey, - NSKeyValueChangeNewKey, - NSKeyValueChangeNotificationIsPriorKey, - NSKeyValueChangeOldKey, NSKeyValueObservingOptions, NSKeyValueSetMutationKind, NSLinguisticTaggerOptions, NSLocale, NSLocaleLanguageDirection, - NSLocalizedDescriptionKey, NSMethodSignature, NSMutableArray, NSMutableCopying, diff --git a/pkgs/objective_c/lib/src/objective_c_bindings_generated.dart b/pkgs/objective_c/lib/src/objective_c_bindings_generated.dart index 2a494eb7c..043286407 100644 --- a/pkgs/objective_c/lib/src/objective_c_bindings_generated.dart +++ b/pkgs/objective_c/lib/src/objective_c_bindings_generated.dart @@ -2,7 +2,7 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -// Bindings for `src/foundation.h`. +// Bindings for package:objective_c's ObjC code and the Foundation framework. // Regenerate bindings with `dart run tool/generate_code.dart`. // ignore_for_file: always_specify_types @@ -12,126 +12,16 @@ // ignore_for_file: unused_element // ignore_for_file: unused_field // coverage:ignore-file -import 'dart:collection'; // AUTO GENERATED FILE, DO NOT EDIT. // // Generated by `package:ffigen`. // ignore_for_file: type=lint +import 'dart:collection' as collection; import 'dart:ffi' as ffi; import '../objective_c.dart' as objc; import 'package:ffi/ffi.dart' as pkg_ffi; -@ffi.Native>(symbol: 'NSKeyValueChangeIndexesKey') -external ffi.Pointer _NSKeyValueChangeIndexesKey; - -NSString get NSKeyValueChangeIndexesKey => NSString.castFromPointer( - _NSKeyValueChangeIndexesKey, - retain: true, - release: true, -); - -set NSKeyValueChangeIndexesKey(NSString value) { - NSString.castFromPointer( - _NSKeyValueChangeIndexesKey, - retain: false, - release: true, - ).ref.release(); - _NSKeyValueChangeIndexesKey = value.ref.retainAndReturnPointer(); -} - -@ffi.Native>(symbol: 'NSKeyValueChangeKindKey') -external ffi.Pointer _NSKeyValueChangeKindKey; - -NSString get NSKeyValueChangeKindKey => NSString.castFromPointer( - _NSKeyValueChangeKindKey, - retain: true, - release: true, -); - -set NSKeyValueChangeKindKey(NSString value) { - NSString.castFromPointer( - _NSKeyValueChangeKindKey, - retain: false, - release: true, - ).ref.release(); - _NSKeyValueChangeKindKey = value.ref.retainAndReturnPointer(); -} - -@ffi.Native>(symbol: 'NSKeyValueChangeNewKey') -external ffi.Pointer _NSKeyValueChangeNewKey; - -NSString get NSKeyValueChangeNewKey => NSString.castFromPointer( - _NSKeyValueChangeNewKey, - retain: true, - release: true, -); - -set NSKeyValueChangeNewKey(NSString value) { - NSString.castFromPointer( - _NSKeyValueChangeNewKey, - retain: false, - release: true, - ).ref.release(); - _NSKeyValueChangeNewKey = value.ref.retainAndReturnPointer(); -} - -@ffi.Native>( - symbol: 'NSKeyValueChangeNotificationIsPriorKey', -) -external ffi.Pointer _NSKeyValueChangeNotificationIsPriorKey; - -NSString get NSKeyValueChangeNotificationIsPriorKey => NSString.castFromPointer( - _NSKeyValueChangeNotificationIsPriorKey, - retain: true, - release: true, -); - -set NSKeyValueChangeNotificationIsPriorKey(NSString value) { - NSString.castFromPointer( - _NSKeyValueChangeNotificationIsPriorKey, - retain: false, - release: true, - ).ref.release(); - _NSKeyValueChangeNotificationIsPriorKey = value.ref.retainAndReturnPointer(); -} - -@ffi.Native>(symbol: 'NSKeyValueChangeOldKey') -external ffi.Pointer _NSKeyValueChangeOldKey; - -NSString get NSKeyValueChangeOldKey => NSString.castFromPointer( - _NSKeyValueChangeOldKey, - retain: true, - release: true, -); - -set NSKeyValueChangeOldKey(NSString value) { - NSString.castFromPointer( - _NSKeyValueChangeOldKey, - retain: false, - release: true, - ).ref.release(); - _NSKeyValueChangeOldKey = value.ref.retainAndReturnPointer(); -} - -@ffi.Native>(symbol: 'NSLocalizedDescriptionKey') -external ffi.Pointer _NSLocalizedDescriptionKey; - -NSString get NSLocalizedDescriptionKey => NSString.castFromPointer( - _NSLocalizedDescriptionKey, - retain: true, - release: true, -); - -set NSLocalizedDescriptionKey(NSString value) { - NSString.castFromPointer( - _NSLocalizedDescriptionKey, - retain: false, - release: true, - ).ref.release(); - _NSLocalizedDescriptionKey = value.ref.retainAndReturnPointer(); -} - @ffi.Native< instancetype Function( ffi.Pointer, @@ -3341,7 +3231,7 @@ enum NSDecodingFailurePolicy { /// NSDictionary class NSDictionary extends NSObject - with MapBase + with collection.MapBase implements NSCopying, NSMutableCopying, NSSecureCoding, NSFastEnumeration { /// Creates a [NSDictionary] from [other]. static NSDictionary of(Map other) => @@ -8943,7 +8833,8 @@ class NSMethodSignature extends NSObject { } /// NSMutableArray -class NSMutableArray extends NSArray with ListBase { +class NSMutableArray extends NSArray + with collection.ListBase { /// Creates a [NSMutableArray] of the given length with [fill] at each /// position. /// @@ -17243,7 +17134,7 @@ interface class NSSecureCoding extends objc.ObjCProtocolBase /// NSSet class NSSet extends NSObject - with SetBase + with collection.SetBase implements NSCopying, NSMutableCopying, NSSecureCoding, NSFastEnumeration { /// Creates a [NSSet] from [elements]. static NSSet of(Iterable elements) => diff --git a/pkgs/objective_c/lib/src/protocol_builder.dart b/pkgs/objective_c/lib/src/protocol_builder.dart index b2b086bc7..5980eb41d 100644 --- a/pkgs/objective_c/lib/src/protocol_builder.dart +++ b/pkgs/objective_c/lib/src/protocol_builder.dart @@ -12,6 +12,7 @@ import 'c_bindings_generated.dart' as c; import 'internal.dart' show FailedToLoadProtocolMethodException, GetProtocolName, ObjCBlockBase; import 'objective_c_bindings_generated.dart' as objc; +import 'runtime_bindings_generated.dart' as r; import 'selector.dart'; /// Helper class for building Objective C objects that implement protocols. @@ -31,7 +32,7 @@ class ObjCProtocolBuilder { /// /// Note: You cannot call this method after you have called [build]. void implementMethod( - Pointer sel, + Pointer sel, Pointer signature, Pointer trampoline, ObjCBlockBase block, @@ -91,8 +92,8 @@ class ObjCProtocolBuilder { /// want to implement. The generated bindings will include a /// [ObjCProtocolMethod] for each method of the protocol. class ObjCProtocolMethod { - final Pointer _proto; - final Pointer _sel; + final Pointer _proto; + final Pointer _sel; final Pointer _trampoline; final Pointer? _signature; final ObjCBlockBase Function(T) _createBlock; diff --git a/pkgs/objective_c/lib/src/runtime_bindings_generated.dart b/pkgs/objective_c/lib/src/runtime_bindings_generated.dart new file mode 100644 index 000000000..aa4829d0e --- /dev/null +++ b/pkgs/objective_c/lib/src/runtime_bindings_generated.dart @@ -0,0 +1,163 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +// Bindings for `src/objective_c_runtime.h`. +// Regenerate bindings with `dart run tool/generate_code.dart`. + +// ignore_for_file: always_specify_types +// ignore_for_file: camel_case_types +// ignore_for_file: non_constant_identifier_names +// ignore_for_file: unused_element +// coverage:ignore-file + +// AUTO GENERATED FILE, DO NOT EDIT. +// +// Generated by `package:ffigen`. +// ignore_for_file: type=lint +import 'dart:ffi' as ffi; + +@ffi.Array.multi([32]) +@ffi.Native>>(symbol: '_NSConcreteAutoBlock') +external ffi.Array> NSConcreteAutoBlock; + +@ffi.Array.multi([32]) +@ffi.Native>>( + symbol: '_NSConcreteFinalizingBlock', +) +external ffi.Array> NSConcreteFinalizingBlock; + +@ffi.Array.multi([32]) +@ffi.Native>>(symbol: '_NSConcreteGlobalBlock') +external ffi.Array> NSConcreteGlobalBlock; + +@ffi.Array.multi([32]) +@ffi.Native>>(symbol: '_NSConcreteMallocBlock') +external ffi.Array> NSConcreteMallocBlock; + +@ffi.Array.multi([32]) +@ffi.Native>>(symbol: '_NSConcreteStackBlock') +external ffi.Array> NSConcreteStackBlock; + +@ffi.Native>() +external ffi.Pointer NSKeyValueChangeIndexesKey; + +@ffi.Native>() +external ffi.Pointer NSKeyValueChangeKindKey; + +@ffi.Native>() +external ffi.Pointer NSKeyValueChangeNewKey; + +@ffi.Native>() +external ffi.Pointer NSKeyValueChangeNotificationIsPriorKey; + +@ffi.Native>() +external ffi.Pointer NSKeyValueChangeOldKey; + +@ffi.Native>() +external ffi.Pointer NSLocalizedDescriptionKey; + +@ffi.Native Function(ffi.Pointer)>( + symbol: 'objc_retainBlock', + isLeaf: true, +) +external ffi.Pointer blockRetain(ffi.Pointer object); + +@ffi.Native< + ffi.Pointer> Function(ffi.Pointer) +>(symbol: 'objc_copyClassList', isLeaf: true) +external ffi.Pointer> copyClassList( + ffi.Pointer count, +); + +@ffi.Native Function(ffi.Pointer)>( + symbol: 'objc_getClass', + isLeaf: true, +) +external ffi.Pointer getClass(ffi.Pointer name); + +@ffi.Native< + ObjCMethodDesc Function( + ffi.Pointer, + ffi.Pointer, + ffi.Bool, + ffi.Bool, + ) +>(symbol: 'protocol_getMethodDescription', isLeaf: true) +external ObjCMethodDesc getMethodDescription( + ffi.Pointer protocol, + ffi.Pointer sel, + bool isRequiredMethod, + bool isInstanceMethod, +); + +@ffi.Native Function(ffi.Pointer)>( + symbol: 'sel_getName', + isLeaf: true, +) +external ffi.Pointer getName(ffi.Pointer sel); + +@ffi.Native Function(ffi.Pointer)>( + symbol: 'object_getClass', + isLeaf: true, +) +external ffi.Pointer getObjectClass(ffi.Pointer object); + +@ffi.Native Function(ffi.Pointer)>( + symbol: 'objc_getProtocol', + isLeaf: true, +) +external ffi.Pointer getProtocol(ffi.Pointer name); + +@ffi.Native Function(ffi.Pointer)>( + symbol: 'protocol_getName', + isLeaf: true, +) +external ffi.Pointer getProtocolName(ffi.Pointer proto); + +@ffi.Native(symbol: 'objc_msgSend') +external void msgSend(); + +@ffi.Native(symbol: 'objc_msgSend_fpret') +external void msgSendFpret(); + +@ffi.Native(symbol: 'objc_msgSend_stret') +external void msgSendStret(); + +@ffi.Native Function(ffi.Pointer)>( + symbol: 'objc_autorelease', + isLeaf: true, +) +external ffi.Pointer objectAutorelease( + ffi.Pointer object, +); + +@ffi.Native)>( + symbol: 'objc_release', + isLeaf: true, +) +external void objectRelease(ffi.Pointer object); + +@ffi.Native Function(ffi.Pointer)>( + symbol: 'objc_retain', + isLeaf: true, +) +external ffi.Pointer objectRetain(ffi.Pointer object); + +@ffi.Native Function(ffi.Pointer)>( + symbol: 'sel_registerName', + isLeaf: true, +) +external ffi.Pointer registerName(ffi.Pointer name); + +final class ObjCMethodDesc extends ffi.Struct { + external ffi.Pointer name; + + external ffi.Pointer types; +} + +final class ObjCObject extends ffi.Opaque {} + +final class ObjCProtocol extends ffi.Opaque {} + +final class ObjCSelector extends ffi.Opaque {} diff --git a/pkgs/objective_c/lib/src/selector.dart b/pkgs/objective_c/lib/src/selector.dart index 93c79be00..f7d70583f 100644 --- a/pkgs/objective_c/lib/src/selector.dart +++ b/pkgs/objective_c/lib/src/selector.dart @@ -6,20 +6,20 @@ import 'dart:ffi'; import 'package:ffi/ffi.dart'; -import 'c_bindings_generated.dart' as c; import 'internal.dart'; +import 'runtime_bindings_generated.dart' as r; extension StringToSelector on String { /// Returns an Objective-C selector (aka `SEL`) for this [String]. /// /// This is equivalent to the Objective-C `@selector()` directive, or the /// `NSSelectorFromString` function. - Pointer toSelector() => registerName(this); + Pointer toSelector() => registerName(this); } -extension SelectorToString on Pointer { +extension SelectorToString on Pointer { /// Returns the string that this Objective-C selector represents. /// /// This is equivalent to the Objective-C `NSSelectorFromString` function. - String toDartString() => c.getName(this).cast().toDartString(); + String toDartString() => r.getName(this).cast().toDartString(); } diff --git a/pkgs/objective_c/macos/Classes/objective_c.c b/pkgs/objective_c/macos/Classes/objective_c.c deleted file mode 100644 index 6d9c021cc..000000000 --- a/pkgs/objective_c/macos/Classes/objective_c.c +++ /dev/null @@ -1,8 +0,0 @@ -// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file -// for details. All rights reserved. Use of this source code is governed by a -// BSD-style license that can be found in the LICENSE file. - -// Relative import to be able to reuse the C sources. -// See the comment in ../objective_c.podspec for more information. -#include "../../src/objective_c.c" -#include "../../src/include/dart_api_dl.c" diff --git a/pkgs/objective_c/macos/Classes/objective_c.m b/pkgs/objective_c/macos/Classes/objective_c.m deleted file mode 100644 index b3ce4fb15..000000000 --- a/pkgs/objective_c/macos/Classes/objective_c.m +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file -// for details. All rights reserved. Use of this source code is governed by a -// BSD-style license that can be found in the LICENSE file. - -// Relative import to be able to reuse the ObjC sources. -// See the comment in ../objective_c.podspec for more information. -#include "../../src/input_stream_adapter.m" -#include "../../src/objective_c.m" -#include "../../src/objective_c_bindings_generated.m" -#include "../../src/observer.m" -#include "../../src/protocol.m" diff --git a/pkgs/objective_c/macos/objective_c.podspec b/pkgs/objective_c/macos/objective_c.podspec deleted file mode 100644 index f3ae43b6b..000000000 --- a/pkgs/objective_c/macos/objective_c.podspec +++ /dev/null @@ -1,27 +0,0 @@ -# -# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html. -# Run `pod lib lint objective_c.podspec` to validate before publishing. -# -Pod::Spec.new do |s| - s.name = 'objective_c' - s.version = '0.0.1' - s.summary = 'A library to access Objective C from Flutter that acts as a support library for package:ffigen.' - s.description = <<-DESC -A library to access Objective C from Flutter that acts as a support library for package:ffigen. - DESC - s.homepage = 'http://example.com' - s.license = { :file => '../LICENSE' } - s.author = { 'Your Company' => 'email@example.com' } - - # This will ensure the source files in Classes/ are included in the native - # builds of apps using this FFI plugin. Podspec does not support relative - # paths, so Classes contains a forwarder C file that relatively imports - # `../src/*` so that the C sources can be shared among all target platforms. - s.source = { :path => '.' } - s.source_files = 'Classes/**/*' - s.dependency 'FlutterMacOS' - - s.platform = :osx, '10.11' - s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES' } - s.swift_version = '5.0' -end diff --git a/pkgs/objective_c/pubspec.yaml b/pkgs/objective_c/pubspec.yaml index 08e3571ce..311245c36 100644 --- a/pkgs/objective_c/pubspec.yaml +++ b/pkgs/objective_c/pubspec.yaml @@ -15,34 +15,30 @@ topics: - codegen environment: - sdk: '>=3.8.0 <4.0.0' - flutter: '>=3.32.0' + sdk: '>=3.9.0-21.0.dev <4.0.0' dependencies: + code_assets: ^0.19.0 ffi: ^2.1.0 - flutter: - sdk: flutter + hooks: ^0.19.0 + logging: ^1.3.0 + native_toolchain_c: ^0.16.0 pub_semver: ^2.1.4 dev_dependencies: args: ^2.6.0 dart_flutter_team_lints: ^3.5.1 ffigen: ^19.1.0 - flutter_lints: ^5.0.0 - flutter_test: - sdk: flutter path: ^1.9.0 - test: ^1.21.1 + test: ^1.26.2 yaml: ^3.1.0 dependency_overrides: + code_assets: + path: ../code_assets ffigen: - path: ../ffigen/ - -flutter: - plugin: - platforms: - ios: - ffiPlugin: true - macos: - ffiPlugin: true + path: ../ffigen + hooks: + path: ../hooks + native_toolchain_c: + path: ../native_toolchain_c diff --git a/pkgs/objective_c/src/CMakeLists.txt b/pkgs/objective_c/src/CMakeLists.txt deleted file mode 100644 index 14fc5b575..000000000 --- a/pkgs/objective_c/src/CMakeLists.txt +++ /dev/null @@ -1,22 +0,0 @@ -# The Flutter tooling requires that developers have CMake 3.10 or later -# installed. You should not increase this version, as doing so will cause -# the plugin to fail to compile for some customers of the plugin. -cmake_minimum_required(VERSION 3.10) - -project(objective_c_library VERSION 0.0.1 LANGUAGES C) - -add_library(objective_c SHARED - "objective_c.c" - "objective_c.m" - "protocol.m" - "include/dart_api_dl.c" -) - -target_link_options(objective_c PRIVATE "-undefined dynamic_lookup") - -set_target_properties(objective_c PROPERTIES - PUBLIC_HEADER objective_c.h - OUTPUT_NAME "objective_c" -) - -target_compile_definitions(objective_c PUBLIC DART_SHARED_LIB) diff --git a/pkgs/objective_c/src/objective_c.c b/pkgs/objective_c/src/objective_c.c index c59a1906a..9b6e31446 100644 --- a/pkgs/objective_c/src/objective_c.c +++ b/pkgs/objective_c/src/objective_c.c @@ -50,10 +50,6 @@ FFI_EXPORT bool* DOBJC_newFinalizableBool(Dart_Handle owner) { return pointer; } -FFI_EXPORT intptr_t DOBJC_initializeApi(void* data) { - return Dart_InitializeApiDL(data); -} - FFI_EXPORT DOBJC_Context* DOBJC_fillContext(DOBJC_Context* context) { context->version = 1; context->newWaiter = DOBJC_newWaiter; diff --git a/pkgs/objective_c/src/objective_c.h b/pkgs/objective_c/src/objective_c.h index a389923ee..598f93ba1 100644 --- a/pkgs/objective_c/src/objective_c.h +++ b/pkgs/objective_c/src/objective_c.h @@ -9,6 +9,28 @@ #include "include/dart_api_dl.h" #include "objective_c_runtime.h" +// See https://clang.llvm.org/docs/Block-ABI-Apple.html +typedef struct _ObjCBlockDesc { + unsigned long int reserved; + unsigned long int size; // sizeof(ObjCBlockImpl) + void (*copy_helper)(void *dst, void *src); + void (*dispose_helper)(void *src); + const char *signature; +} ObjCBlockDesc; + +typedef struct _ObjCBlockImpl { + void *isa; // _NSConcreteGlobalBlock + int flags; + int reserved; + void *invoke; // RET (*invoke)(ObjCBlockImpl *, ARGS...); + ObjCBlockDesc *descriptor; + + // Captured variables follow. These are specific to our use case. + void *target; + Dart_Port dispose_port; + void* trampoline; +} ObjCBlockImpl; + // Initialize the Dart API. FFI_EXPORT intptr_t DOBJC_initializeApi(void *data); @@ -36,10 +58,6 @@ FFI_EXPORT bool *DOBJC_newFinalizableBool(Dart_Handle owner); // Runs fn(arg) on the main thread. If runOnMainThread is already running on the // main thread, fn(arg) is invoked synchronously. Otherwise it is dispatched to // the main thread (ie dispatch_async(dispatch_get_main_queue(), ...)). -// -// This assumes that the main thread is executing its queue. If not, #define -// NO_MAIN_THREAD_DISPATCH to disable this, and run fn(arg) synchronously. The -// flutter runner does execute the main dispatch queue, but the Dart VM doesn't. FFI_EXPORT void DOBJC_runOnMainThread(void (*fn)(void *), void *arg); // Functions for creating a waiter, signaling it, and waiting for the signal. A diff --git a/pkgs/objective_c/src/objective_c.m b/pkgs/objective_c/src/objective_c.m index cebdaba73..b55e7af84 100644 --- a/pkgs/objective_c/src/objective_c.m +++ b/pkgs/objective_c/src/objective_c.m @@ -8,20 +8,26 @@ #import #include "ffi.h" +#include "include/dart_api_dl.h" #include "os_version.h" +_Atomic bool _mainThreadIsListening = false; + +FFI_EXPORT intptr_t DOBJC_initializeApi(void* data) { + dispatch_async(dispatch_get_main_queue(), ^{ + _mainThreadIsListening = true; + }); + return Dart_InitializeApiDL(data); +} + FFI_EXPORT void DOBJC_runOnMainThread(void (*fn)(void *), void *arg) { -#ifdef NO_MAIN_THREAD_DISPATCH - fn(arg); -#else - if ([NSThread isMainThread]) { + if (!_mainThreadIsListening || [NSThread isMainThread]) { fn(arg); } else { dispatch_async(dispatch_get_main_queue(), ^{ fn(arg); }); } -#endif } @interface DOBJCWaiter : NSObject {} diff --git a/pkgs/objective_c/src/objective_c_runtime.h b/pkgs/objective_c/src/objective_c_runtime.h index f911c549f..bc9179528 100644 --- a/pkgs/objective_c/src/objective_c_runtime.h +++ b/pkgs/objective_c/src/objective_c_runtime.h @@ -31,27 +31,6 @@ void objc_msgSend(void); void objc_msgSend_fpret(void); void objc_msgSend_stret(void); -// See https://clang.llvm.org/docs/Block-ABI-Apple.html -typedef struct _ObjCBlockDesc { - unsigned long int reserved; - unsigned long int size; // sizeof(ObjCBlockImpl) - void (*copy_helper)(void *dst, void *src); - void (*dispose_helper)(void *src); - const char *signature; -} ObjCBlockDesc; - -typedef struct _ObjCBlockImpl { - void *isa; // _NSConcreteGlobalBlock - int flags; - int reserved; - void *invoke; // RET (*invoke)(ObjCBlockImpl *, ARGS...); - ObjCBlockDesc *descriptor; - - // Captured variables follow. These are specific to our use case. - void *target; - Dart_Port dispose_port; -} ObjCBlockImpl; - // https://opensource.apple.com/source/libclosure/libclosure-38/Block_private.h extern void *_NSConcreteStackBlock[32]; extern void *_NSConcreteMallocBlock[32]; @@ -71,4 +50,11 @@ ObjCMethodDesc protocol_getMethodDescription( bool isInstanceMethod); const char *protocol_getName(ObjCProtocol *proto); +extern const ObjCObject *NSKeyValueChangeIndexesKey; +extern const ObjCObject *NSKeyValueChangeKindKey; +extern const ObjCObject *NSKeyValueChangeNewKey; +extern const ObjCObject *NSKeyValueChangeNotificationIsPriorKey; +extern const ObjCObject *NSKeyValueChangeOldKey; +extern const ObjCObject *NSLocalizedDescriptionKey; + #endif // OBJECTIVE_C_SRC_OBJECTIVE_C_RUNTIME_H_ diff --git a/pkgs/objective_c/test/cf_string_test.dart b/pkgs/objective_c/test/cf_string_test.dart index 84d76b132..dbde1fb1f 100644 --- a/pkgs/objective_c/test/cf_string_test.dart +++ b/pkgs/objective_c/test/cf_string_test.dart @@ -6,20 +6,11 @@ @TestOn('mac-os') library; -import 'dart:ffi'; - import 'package:objective_c/objective_c.dart'; import 'package:test/test.dart'; -import 'util.dart'; - void main() { group('CFString', () { - setUpAll(() { - // TODO(https://github.com/dart-lang/native/issues/1068): Remove this. - DynamicLibrary.open(testDylib); - }); - for (final s in ['Hello', '🇵🇬', 'Embedded\u0000Null']) { test('CFString conversions [$s]', () { final cfString = s diff --git a/pkgs/objective_c/test/converter_test.dart b/pkgs/objective_c/test/converter_test.dart index 6cc3259d0..4a97ccc9b 100644 --- a/pkgs/objective_c/test/converter_test.dart +++ b/pkgs/objective_c/test/converter_test.dart @@ -6,20 +6,11 @@ @TestOn('mac-os') library; -import 'dart:ffi'; - import 'package:objective_c/objective_c.dart'; import 'package:test/test.dart'; -import 'util.dart'; - void main() { group('converter', () { - setUpAll(() { - // TODO(https://github.com/dart-lang/native/issues/1068): Remove this. - DynamicLibrary.open(testDylib); - }); - test('basics', () { final obj = NSObject(); expect(toObjCObject(obj), obj); diff --git a/pkgs/objective_c/test/generate_code_test.dart b/pkgs/objective_c/test/generate_code_test.dart index 5d9bb59ab..511a21e4e 100644 --- a/pkgs/objective_c/test/generate_code_test.dart +++ b/pkgs/objective_c/test/generate_code_test.dart @@ -22,13 +22,22 @@ void main() { await expectLater(generate_code.run(format: true), completes); // Sanity check the generated code. + final rBindings = File( + 'lib/src/runtime_bindings_generated.dart', + ).readAsStringSync(); + expect(rBindings, contains('sel_registerName')); + expect(rBindings, contains('objc_msgSend')); + expect(rBindings, contains('_NSConcreteGlobalBlock')); + expect(rBindings, contains('ObjCObject')); + final cBindings = File( 'lib/src/c_bindings_generated.dart', ).readAsStringSync(); - expect(cBindings, contains('sel_registerName')); - expect(cBindings, contains('objc_msgSend')); - expect(cBindings, contains('_NSConcreteGlobalBlock')); - expect(cBindings, contains('ObjCBlock')); + expect(cBindings, contains('fillContext')); + expect(cBindings, contains('DOBJC_Context')); + expect(cBindings, contains('Dart_FinalizableHandle')); + expect(cBindings, contains('ILLEGAL_PORT')); + expect(cBindings, contains('ObjCBlockImpl')); final objcBindings = File( 'lib/src/objective_c_bindings_generated.dart', diff --git a/pkgs/objective_c/test/interface_lists_test.dart b/pkgs/objective_c/test/interface_lists_test.dart index 6ba8cb3e0..493d6be57 100644 --- a/pkgs/objective_c/test/interface_lists_test.dart +++ b/pkgs/objective_c/test/interface_lists_test.dart @@ -87,11 +87,6 @@ void main() { ); }); - test('All code genned globals are included in the list', () { - final allGlobals = findBindings(RegExp(r'^\w+ get (\w+) =>')); - expectSetsEqual('generated globals', objCBuiltInGlobals, allGlobals); - }); - test('No stubs', () { final stubRegExp = RegExp(r'\Wstub\W'); expect(bindings.where(stubRegExp.hasMatch).toList(), []); diff --git a/pkgs/objective_c/test/ns_input_stream_test.dart b/pkgs/objective_c/test/ns_input_stream_test.dart index 6caaed3d7..26dc86378 100644 --- a/pkgs/objective_c/test/ns_input_stream_test.dart +++ b/pkgs/objective_c/test/ns_input_stream_test.dart @@ -41,11 +41,6 @@ Future<(int, Uint8List, bool, NSStreamStatus, NSError?)> read( void main() { group('NSInputStream', () { - setUpAll(() { - // TODO(https://github.com/dart-lang/native/issues/1068): Remove this. - DynamicLibrary.open(testDylib); - }); - group('toNSInputStream', () { group('empty', () { late NSInputStream inputStream; diff --git a/pkgs/objective_c/test/ns_mutable_data_test.dart b/pkgs/objective_c/test/ns_mutable_data_test.dart index 57e144842..970ca5976 100644 --- a/pkgs/objective_c/test/ns_mutable_data_test.dart +++ b/pkgs/objective_c/test/ns_mutable_data_test.dart @@ -12,15 +12,8 @@ import 'package:ffi/ffi.dart'; import 'package:objective_c/objective_c.dart'; import 'package:test/test.dart'; -import 'util.dart'; - void main() { group('NSData', () { - setUpAll(() { - // TODO(https://github.com/dart-lang/native/issues/1068): Remove this. - DynamicLibrary.open(testDylib); - }); - group('toNSData', () { test('empty', () { final data = [].toNSMutableData(); diff --git a/pkgs/objective_c/test/nsarray_test.dart b/pkgs/objective_c/test/nsarray_test.dart index c366401bb..1a0dbc46c 100644 --- a/pkgs/objective_c/test/nsarray_test.dart +++ b/pkgs/objective_c/test/nsarray_test.dart @@ -6,20 +6,11 @@ @TestOn('mac-os') library; -import 'dart:ffi'; - import 'package:objective_c/objective_c.dart'; import 'package:test/test.dart'; -import 'util.dart'; - void main() { group('NSArray', () { - setUpAll(() { - // TODO(https://github.com/dart-lang/native/issues/1068): Remove this. - DynamicLibrary.open(testDylib); - }); - test('filled', () { final obj = NSObject(); final array = NSArray.filled(3, obj); diff --git a/pkgs/objective_c/test/nsdata_test.dart b/pkgs/objective_c/test/nsdata_test.dart index 6c6250480..99f9f2d59 100644 --- a/pkgs/objective_c/test/nsdata_test.dart +++ b/pkgs/objective_c/test/nsdata_test.dart @@ -12,15 +12,8 @@ import 'package:ffi/ffi.dart'; import 'package:objective_c/objective_c.dart'; import 'package:test/test.dart'; -import 'util.dart'; - void main() { group('NSData', () { - setUpAll(() { - // TODO(https://github.com/dart-lang/native/issues/1068): Remove this. - DynamicLibrary.open(testDylib); - }); - group('toNSData', () { test('empty', () { final data = [].toNSData(); diff --git a/pkgs/objective_c/test/nsdate_test.dart b/pkgs/objective_c/test/nsdate_test.dart index 5dcd5029e..4079e60b4 100644 --- a/pkgs/objective_c/test/nsdate_test.dart +++ b/pkgs/objective_c/test/nsdate_test.dart @@ -6,20 +6,11 @@ @TestOn('mac-os') library; -import 'dart:ffi'; - import 'package:objective_c/objective_c.dart'; import 'package:test/test.dart'; -import 'util.dart'; - void main() { group('NSDate', () { - setUpAll(() { - // TODO(https://github.com/dart-lang/native/issues/1068): Remove this. - DynamicLibrary.open(testDylib); - }); - test('from DateTime', () { final dartFirstAppeared = DateTime.utc(2011, 10, 10); final nsDate = dartFirstAppeared.toNSDate(); diff --git a/pkgs/objective_c/test/nsdictionary_test.dart b/pkgs/objective_c/test/nsdictionary_test.dart index 04b970a81..7c860561c 100644 --- a/pkgs/objective_c/test/nsdictionary_test.dart +++ b/pkgs/objective_c/test/nsdictionary_test.dart @@ -6,20 +6,11 @@ @TestOn('mac-os') library; -import 'dart:ffi'; - import 'package:objective_c/objective_c.dart'; import 'package:test/test.dart'; -import 'util.dart'; - void main() { group('NSDictionary', () { - setUpAll(() { - // TODO(https://github.com/dart-lang/native/issues/1068): Remove this. - DynamicLibrary.open(testDylib); - }); - test('of', () { final obj1 = 'obj1'.toNSString(); final obj2 = 'obj2'.toNSString(); diff --git a/pkgs/objective_c/test/nsmutablearray_test.dart b/pkgs/objective_c/test/nsmutablearray_test.dart index d01b21571..b77706182 100644 --- a/pkgs/objective_c/test/nsmutablearray_test.dart +++ b/pkgs/objective_c/test/nsmutablearray_test.dart @@ -6,20 +6,11 @@ @TestOn('mac-os') library; -import 'dart:ffi'; - import 'package:objective_c/objective_c.dart'; import 'package:test/test.dart'; -import 'util.dart'; - void main() { group('NSMutableArray', () { - setUpAll(() { - // TODO(https://github.com/dart-lang/native/issues/1068): Remove this. - DynamicLibrary.open(testDylib); - }); - test('filled', () { final obj = NSObject(); final array = NSMutableArray.filled(3, obj); diff --git a/pkgs/objective_c/test/nsmutabledictionary_test.dart b/pkgs/objective_c/test/nsmutabledictionary_test.dart index 4c2e60c14..eefcdaa41 100644 --- a/pkgs/objective_c/test/nsmutabledictionary_test.dart +++ b/pkgs/objective_c/test/nsmutabledictionary_test.dart @@ -6,20 +6,11 @@ @TestOn('mac-os') library; -import 'dart:ffi'; - import 'package:objective_c/objective_c.dart'; import 'package:test/test.dart'; -import 'util.dart'; - void main() { group('NSMutableDictionary', () { - setUpAll(() { - // TODO(https://github.com/dart-lang/native/issues/1068): Remove this. - DynamicLibrary.open(testDylib); - }); - test('of', () { final obj1 = 'obj1'.toNSString(); final obj2 = 'obj2'.toNSString(); diff --git a/pkgs/objective_c/test/nsmutableset_test.dart b/pkgs/objective_c/test/nsmutableset_test.dart index e294cfb43..2de160122 100644 --- a/pkgs/objective_c/test/nsmutableset_test.dart +++ b/pkgs/objective_c/test/nsmutableset_test.dart @@ -6,20 +6,11 @@ @TestOn('mac-os') library; -import 'dart:ffi'; - import 'package:objective_c/objective_c.dart'; import 'package:test/test.dart'; -import 'util.dart'; - void main() { group('NSMutableSet', () { - setUpAll(() { - // TODO(https://github.com/dart-lang/native/issues/1068): Remove this. - DynamicLibrary.open(testDylib); - }); - test('of', () { final obj1 = NSObject(); final obj2 = NSObject(); diff --git a/pkgs/objective_c/test/nsnumber_test.dart b/pkgs/objective_c/test/nsnumber_test.dart index bcecd1e93..4cca1eb1f 100644 --- a/pkgs/objective_c/test/nsnumber_test.dart +++ b/pkgs/objective_c/test/nsnumber_test.dart @@ -6,20 +6,11 @@ @TestOn('mac-os') library; -import 'dart:ffi'; - import 'package:objective_c/objective_c.dart'; import 'package:test/test.dart'; -import 'util.dart'; - void main() { group('NSNumber', () { - setUpAll(() { - // TODO(https://github.com/dart-lang/native/issues/1068): Remove this. - DynamicLibrary.open(testDylib); - }); - test('from double', () { final n = 1.23.toNSNumber(); diff --git a/pkgs/objective_c/test/nsset_test.dart b/pkgs/objective_c/test/nsset_test.dart index 29e912788..ff5253fd1 100644 --- a/pkgs/objective_c/test/nsset_test.dart +++ b/pkgs/objective_c/test/nsset_test.dart @@ -6,20 +6,11 @@ @TestOn('mac-os') library; -import 'dart:ffi'; - import 'package:objective_c/objective_c.dart'; import 'package:test/test.dart'; -import 'util.dart'; - void main() { group('NSSet', () { - setUpAll(() { - // TODO(https://github.com/dart-lang/native/issues/1068): Remove this. - DynamicLibrary.open(testDylib); - }); - test('of', () { final obj1 = NSObject(); final obj2 = NSObject(); diff --git a/pkgs/objective_c/test/nsstring_test.dart b/pkgs/objective_c/test/nsstring_test.dart index c58ab33ba..9aaf5052e 100644 --- a/pkgs/objective_c/test/nsstring_test.dart +++ b/pkgs/objective_c/test/nsstring_test.dart @@ -6,20 +6,11 @@ @TestOn('mac-os') library; -import 'dart:ffi'; - import 'package:objective_c/objective_c.dart'; import 'package:test/test.dart'; -import 'util.dart'; - void main() { group('NSString', () { - setUpAll(() { - // TODO(https://github.com/dart-lang/native/issues/1068): Remove this. - DynamicLibrary.open(testDylib); - }); - for (final s in ['Hello', '🇵🇬', 'Embedded\u0000Null']) { test('NSString to/from Dart string [$s]', () { final ns1 = NSString(s); diff --git a/pkgs/objective_c/test/observer_test.dart b/pkgs/objective_c/test/observer_test.dart index f92b37934..1f68c94c3 100644 --- a/pkgs/objective_c/test/observer_test.dart +++ b/pkgs/objective_c/test/observer_test.dart @@ -15,11 +15,6 @@ import 'util.dart'; void main() { group('Observer', () { - setUpAll(() { - // TODO(https://github.com/dart-lang/native/issues/1068): Remove this. - DynamicLibrary.open(testDylib); - }); - test('receive updates', () { // Using NSProgress here because it's already part of our generated // bindings and has a property with a getter and setter. diff --git a/pkgs/objective_c/test/os_version_test.dart b/pkgs/objective_c/test/os_version_test.dart index 8a5a82491..aed4c57f1 100644 --- a/pkgs/objective_c/test/os_version_test.dart +++ b/pkgs/objective_c/test/os_version_test.dart @@ -6,20 +6,11 @@ @TestOn('mac-os') library; -import 'dart:ffi'; - import 'package:objective_c/objective_c.dart'; import 'package:test/test.dart'; -import 'util.dart'; - void main() { group('osVersion', () { - setUpAll(() { - // TODO(https://github.com/dart-lang/native/issues/1068): Remove this. - DynamicLibrary.open(testDylib); - }); - test('getter', () { // macOS 11 was released in 2020 and isn't supported anymore. final oldVersion = Version(11, 0, 0); diff --git a/pkgs/objective_c/test/selector_test.dart b/pkgs/objective_c/test/selector_test.dart index cf2d68d79..9a96dd1a7 100644 --- a/pkgs/objective_c/test/selector_test.dart +++ b/pkgs/objective_c/test/selector_test.dart @@ -6,20 +6,11 @@ @TestOn('mac-os') library; -import 'dart:ffi'; - import 'package:objective_c/objective_c.dart'; import 'package:test/test.dart'; -import 'util.dart'; - void main() { group('Selector', () { - setUpAll(() { - // TODO(https://github.com/dart-lang/native/issues/1068): Remove this. - DynamicLibrary.open(testDylib); - }); - test('from String and back', () { expect('hello'.toSelector().toDartString(), 'hello'); expect(''.toSelector().toDartString(), ''); diff --git a/pkgs/objective_c/test/setup.dart b/pkgs/objective_c/test/setup.dart deleted file mode 100644 index a7ae84d0c..000000000 --- a/pkgs/objective_c/test/setup.dart +++ /dev/null @@ -1,103 +0,0 @@ -// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file -// for details. All rights reserved. Use of this source code is governed by a -// BSD-style license that can be found in the LICENSE file. - -// When users import package:objective_c as a plugin, Flutter builds our native -// code automatically. But we want to be able to run tests using `dart test`, so -// we can't use Flutter's build system. So this script builds a dylib containing -// all that native code. - -// ignore_for_file: avoid_print - -import 'dart:ffi'; -import 'dart:io'; - -import 'package:args/args.dart'; - -final cFiles = [ - 'src/objective_c.c', - 'src/include/dart_api_dl.c', - 'test/util.c', -].map(_resolve); -final cMain = _resolve('test/main.c'); -final objCFiles = [ - 'src/input_stream_adapter.m', - 'src/ns_number.m', - 'src/objective_c.m', - 'src/objective_c_bindings_generated.m', - 'src/observer.m', - 'src/protocol.m', -].map(_resolve); -const objCFlags = ['-x', 'objective-c', '-fobjc-arc']; -final outputFile = _resolve('test/objective_c.dylib'); - -final _repoDir = () { - var path = Platform.script; - while (path.pathSegments.isNotEmpty) { - path = path.resolve('..'); - if (Directory(path.resolve('.git').toFilePath()).existsSync()) { - return path; - } - } - throw Exception("Can't find .git dir above ${Platform.script}"); -}(); -final _pkgDir = _repoDir.resolve('pkgs/objective_c/'); -String _resolve(String file) => _pkgDir.resolve(file).toFilePath(); - -void _runClang(List flags, String output) { - final args = [...flags, '-o', output]; - const exec = 'clang'; - print('Running: $exec ${args.join(" ")}'); - final proc = Process.runSync(exec, args); - print(proc.stdout); - print(proc.stderr); - if (proc.exitCode != 0) { - exitCode = proc.exitCode; - throw Exception('Command failed: $exec ${args.join(" ")}'); - } - print('Generated $output'); -} - -String _buildObject(String input, List flags) { - final output = '$input.o'; - _runClang([...flags, '-c', input, '-fpic', '-I', 'src'], output); - return output; -} - -void _linkLib(List inputs, String output) => - _runClang(['-shared', '-undefined', 'dynamic_lookup', ...inputs], output); - -void _linkMain(List inputs, String output) => - _runClang(['-dead_strip', '-fobjc-arc', ...inputs], output); - -void main(List arguments) { - final parser = ArgParser(); - parser.addFlag('main-thread-dispatcher'); - final args = parser.parse(arguments); - - final flags = [ - if (!args.flag('main-thread-dispatcher')) '-DNO_MAIN_THREAD_DISPATCH', - ]; - final objFiles = [ - for (final src in cFiles) _buildObject(src, flags), - for (final src in objCFiles) _buildObject(src, [...objCFlags, ...flags]), - ]; - _linkLib(objFiles, outputFile); - - // Sanity check that the dylib was created correctly. - final lib = DynamicLibrary.open(outputFile); - lib.lookup('DOBJC_disposeObjCBlockWithClosure'); // objective_c.c - lib.lookup('DOBJC_runOnMainThread'); // objective_c.m - lib.lookup('Dart_InitializeApiDL'); // dart_api_dl.c - lib.lookup('OBJC_CLASS_\$_DOBJCDartProtocol'); // protocol.m - lib.lookup('OBJC_CLASS_\$_DOBJCObservation'); // observer.m - // objective_c_bindings_generated.m - lib.lookup('_ObjectiveCBindings_wrapListenerBlock_ovsamd'); - - // Sanity check that the executable can find FFI symbols. - _linkMain([...objFiles, cMain], '$cMain.exe'); - final result = Process.runSync('$cMain.exe', []); - if (result.exitCode != 0) { - throw Exception('Missing symbols from executable:\n${result.stderr}'); - } -} diff --git a/pkgs/objective_c/test/util.dart b/pkgs/objective_c/test/util.dart index 95897ec05..85967c5d6 100644 --- a/pkgs/objective_c/test/util.dart +++ b/pkgs/objective_c/test/util.dart @@ -15,7 +15,6 @@ import 'package:objective_c/objective_c.dart'; import 'package:objective_c/src/internal.dart' as internal_for_testing show isValidClass; -import 'package:path/path.dart' as p; final _executeInternalCommand = () { try { @@ -84,9 +83,6 @@ int objectRetainCount(Pointer object) { String pkgDir = findPackageRoot('objective_c').toFilePath(); -// TODO(https://github.com/dart-lang/native/issues/1068): Remove this. -String testDylib = p.join(pkgDir, 'test', 'objective_c.dylib'); - /// Test files are run in a variety of ways, find this package root in all. /// /// Test files can be run from source from any working directory. The Dart SDK diff --git a/pkgs/objective_c/tool/data/extra_methods.dart.in b/pkgs/objective_c/tool/data/extra_methods.dart.in index 24e951dba..027b37274 100644 --- a/pkgs/objective_c/tool/data/extra_methods.dart.in +++ b/pkgs/objective_c/tool/data/extra_methods.dart.in @@ -43,7 +43,7 @@ class NSArray with Iterable { objc.ObjCObjectBase operator [](int index) => objectAtIndex(index); } -class NSMutableArray with ListBase { +class NSMutableArray with collection.ListBase { /// Creates a [NSMutableArray] of the given length with [fill] at each /// position. /// @@ -113,7 +113,7 @@ class _NSArrayIterator implements Iterator { // Ideally we'd mixin UnmodifiableMapBase, but it's an ordinary class. So // instead we mixin MapBase and then throw in all the modifying methods (which // is essentially what UnmodifiableMapBase does anyway). -class NSDictionary with MapBase { +class NSDictionary with collection.MapBase { /// Creates a [NSDictionary] from [other]. static NSDictionary of(Map other) => NSMutableDictionary.of(other); @@ -232,7 +232,7 @@ class _NSDictionaryKeyIterator implements Iterator { bool moveNext() => _iterator.moveNext(); } -class NSSet with SetBase { +class NSSet with collection.SetBase { /// Creates a [NSSet] from [elements]. static NSSet of(Iterable elements) => NSMutableSet.of(elements); diff --git a/pkgs/objective_c/tool/generate_code.dart b/pkgs/objective_c/tool/generate_code.dart index 5c298bc58..47f61ba03 100644 --- a/pkgs/objective_c/tool/generate_code.dart +++ b/pkgs/objective_c/tool/generate_code.dart @@ -13,8 +13,10 @@ import 'package:args/args.dart'; import 'package:ffigen/src/executables/ffigen.dart' as ffigen; import 'package:yaml/yaml.dart'; +const runtimeConfig = 'ffigen_runtime.yaml'; const cConfig = 'ffigen_c.yaml'; const objcConfig = 'ffigen_objc.yaml'; +const runtimeBindings = 'lib/src/runtime_bindings_generated.dart'; const cBindings = 'lib/src/c_bindings_generated.dart'; const objcBindings = 'lib/src/objective_c_bindings_generated.dart'; const objcExports = 'lib/src/objective_c_bindings_exported.dart'; @@ -23,7 +25,7 @@ const builtInTypes = '../ffigen/lib/src/code_generator/objc_built_in_types.dart'; const interfaceListTest = 'test/interface_lists_test.dart'; -const privateClasses = {'DartInputStreamAdapter', 'DOBJCObservation'}; +const ffigenFlags = ['--no-format', '-v', 'severe', '--config']; void dartCmd(List args) { final exec = Platform.resolvedExecutable; @@ -176,11 +178,10 @@ ${elements.join('\n')} writeDecls('objCBuiltInEnums', 'enums'); writeDecls('objCBuiltInProtocols', 'objc-protocols'); writeDecls('objCBuiltInCategories', 'objc-categories'); - writeDecls('objCBuiltInGlobals', 'globals'); File(out).writeAsStringSync(s.toString()); - return exports.difference(privateClasses).toList()..sort(); + return exports.toList()..sort(); } void writeExports(List exports, String out) { @@ -198,22 +199,32 @@ export 'objective_c_bindings_generated.dart' } Future run({required bool format}) async { + print('Generating runtime bindings...'); + await ffigen.main([...ffigenFlags, runtimeConfig]); + print('Generating C bindings...'); - await ffigen.main(['--no-format', '-v', 'severe', '--config', cConfig]); + await ffigen.main([...ffigenFlags, cConfig]); print('Generating ObjC bindings...'); - await ffigen.main(['--no-format', '-v', 'severe', '--config', objcConfig]); + await ffigen.main([...ffigenFlags, objcConfig]); mergeExtraMethods(objcBindings, parseExtraMethods(extraMethodsFile)); print('Generating objc_built_in_types.dart...'); final exports = writeBuiltInTypes(objcConfig, builtInTypes); - print('Generating objective_c_bindings_exported.dart...'); + print('Generating objc_bindings_exported.dart...'); writeExports(exports, objcExports); if (format) { print('Formatting bindings...'); - dartCmd(['format', cBindings, objcBindings, builtInTypes, objcExports]); + dartCmd([ + 'format', + runtimeBindings, + cBindings, + objcBindings, + builtInTypes, + objcExports, + ]); } print('Running tests...'); diff --git a/pkgs/swiftgen/example/temp/AVFAudioWrapper.h b/pkgs/swiftgen/example/temp/AVFAudioWrapper.h new file mode 100644 index 000000000..6c12e248b --- /dev/null +++ b/pkgs/swiftgen/example/temp/AVFAudioWrapper.h @@ -0,0 +1,1261 @@ +// Generated by Apple Swift version 6.0.3 effective-5.10 (swiftlang-6.0.3.1.10 clang-1600.0.30.1) +#ifndef AVFAUDIOWRAPPER_SWIFT_H +#define AVFAUDIOWRAPPER_SWIFT_H +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wgcc-compat" + +#if !defined(__has_include) +# define __has_include(x) 0 +#endif +#if !defined(__has_attribute) +# define __has_attribute(x) 0 +#endif +#if !defined(__has_feature) +# define __has_feature(x) 0 +#endif +#if !defined(__has_warning) +# define __has_warning(x) 0 +#endif + +#if __has_include() +# include +#endif + +#pragma clang diagnostic ignored "-Wauto-import" +#if defined(__OBJC__) +#include +#endif +#if defined(__cplusplus) +#include +#include +#include +#include +#include +#include +#include +#else +#include +#include +#include +#include +#endif +#if defined(__cplusplus) +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wnon-modular-include-in-framework-module" +#if defined(__arm64e__) && __has_include() +# include +#else +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wreserved-macro-identifier" +# ifndef __ptrauth_swift_value_witness_function_pointer +# define __ptrauth_swift_value_witness_function_pointer(x) +# endif +# ifndef __ptrauth_swift_class_method_pointer +# define __ptrauth_swift_class_method_pointer(x) +# endif +#pragma clang diagnostic pop +#endif +#pragma clang diagnostic pop +#endif + +#if !defined(SWIFT_TYPEDEFS) +# define SWIFT_TYPEDEFS 1 +# if __has_include() +# include +# elif !defined(__cplusplus) +typedef uint_least16_t char16_t; +typedef uint_least32_t char32_t; +# endif +typedef float swift_float2 __attribute__((__ext_vector_type__(2))); +typedef float swift_float3 __attribute__((__ext_vector_type__(3))); +typedef float swift_float4 __attribute__((__ext_vector_type__(4))); +typedef double swift_double2 __attribute__((__ext_vector_type__(2))); +typedef double swift_double3 __attribute__((__ext_vector_type__(3))); +typedef double swift_double4 __attribute__((__ext_vector_type__(4))); +typedef int swift_int2 __attribute__((__ext_vector_type__(2))); +typedef int swift_int3 __attribute__((__ext_vector_type__(3))); +typedef int swift_int4 __attribute__((__ext_vector_type__(4))); +typedef unsigned int swift_uint2 __attribute__((__ext_vector_type__(2))); +typedef unsigned int swift_uint3 __attribute__((__ext_vector_type__(3))); +typedef unsigned int swift_uint4 __attribute__((__ext_vector_type__(4))); +#endif + +#if !defined(SWIFT_PASTE) +# define SWIFT_PASTE_HELPER(x, y) x##y +# define SWIFT_PASTE(x, y) SWIFT_PASTE_HELPER(x, y) +#endif +#if !defined(SWIFT_METATYPE) +# define SWIFT_METATYPE(X) Class +#endif +#if !defined(SWIFT_CLASS_PROPERTY) +# if __has_feature(objc_class_property) +# define SWIFT_CLASS_PROPERTY(...) __VA_ARGS__ +# else +# define SWIFT_CLASS_PROPERTY(...) +# endif +#endif +#if !defined(SWIFT_RUNTIME_NAME) +# if __has_attribute(objc_runtime_name) +# define SWIFT_RUNTIME_NAME(X) __attribute__((objc_runtime_name(X))) +# else +# define SWIFT_RUNTIME_NAME(X) +# endif +#endif +#if !defined(SWIFT_COMPILE_NAME) +# if __has_attribute(swift_name) +# define SWIFT_COMPILE_NAME(X) __attribute__((swift_name(X))) +# else +# define SWIFT_COMPILE_NAME(X) +# endif +#endif +#if !defined(SWIFT_METHOD_FAMILY) +# if __has_attribute(objc_method_family) +# define SWIFT_METHOD_FAMILY(X) __attribute__((objc_method_family(X))) +# else +# define SWIFT_METHOD_FAMILY(X) +# endif +#endif +#if !defined(SWIFT_NOESCAPE) +# if __has_attribute(noescape) +# define SWIFT_NOESCAPE __attribute__((noescape)) +# else +# define SWIFT_NOESCAPE +# endif +#endif +#if !defined(SWIFT_RELEASES_ARGUMENT) +# if __has_attribute(ns_consumed) +# define SWIFT_RELEASES_ARGUMENT __attribute__((ns_consumed)) +# else +# define SWIFT_RELEASES_ARGUMENT +# endif +#endif +#if !defined(SWIFT_WARN_UNUSED_RESULT) +# if __has_attribute(warn_unused_result) +# define SWIFT_WARN_UNUSED_RESULT __attribute__((warn_unused_result)) +# else +# define SWIFT_WARN_UNUSED_RESULT +# endif +#endif +#if !defined(SWIFT_NORETURN) +# if __has_attribute(noreturn) +# define SWIFT_NORETURN __attribute__((noreturn)) +# else +# define SWIFT_NORETURN +# endif +#endif +#if !defined(SWIFT_CLASS_EXTRA) +# define SWIFT_CLASS_EXTRA +#endif +#if !defined(SWIFT_PROTOCOL_EXTRA) +# define SWIFT_PROTOCOL_EXTRA +#endif +#if !defined(SWIFT_ENUM_EXTRA) +# define SWIFT_ENUM_EXTRA +#endif +#if !defined(SWIFT_CLASS) +# if __has_attribute(objc_subclassing_restricted) +# define SWIFT_CLASS(SWIFT_NAME) SWIFT_RUNTIME_NAME(SWIFT_NAME) __attribute__((objc_subclassing_restricted)) SWIFT_CLASS_EXTRA +# define SWIFT_CLASS_NAMED(SWIFT_NAME) __attribute__((objc_subclassing_restricted)) SWIFT_COMPILE_NAME(SWIFT_NAME) SWIFT_CLASS_EXTRA +# else +# define SWIFT_CLASS(SWIFT_NAME) SWIFT_RUNTIME_NAME(SWIFT_NAME) SWIFT_CLASS_EXTRA +# define SWIFT_CLASS_NAMED(SWIFT_NAME) SWIFT_COMPILE_NAME(SWIFT_NAME) SWIFT_CLASS_EXTRA +# endif +#endif +#if !defined(SWIFT_RESILIENT_CLASS) +# if __has_attribute(objc_class_stub) +# define SWIFT_RESILIENT_CLASS(SWIFT_NAME) SWIFT_CLASS(SWIFT_NAME) __attribute__((objc_class_stub)) +# define SWIFT_RESILIENT_CLASS_NAMED(SWIFT_NAME) __attribute__((objc_class_stub)) SWIFT_CLASS_NAMED(SWIFT_NAME) +# else +# define SWIFT_RESILIENT_CLASS(SWIFT_NAME) SWIFT_CLASS(SWIFT_NAME) +# define SWIFT_RESILIENT_CLASS_NAMED(SWIFT_NAME) SWIFT_CLASS_NAMED(SWIFT_NAME) +# endif +#endif +#if !defined(SWIFT_PROTOCOL) +# define SWIFT_PROTOCOL(SWIFT_NAME) SWIFT_RUNTIME_NAME(SWIFT_NAME) SWIFT_PROTOCOL_EXTRA +# define SWIFT_PROTOCOL_NAMED(SWIFT_NAME) SWIFT_COMPILE_NAME(SWIFT_NAME) SWIFT_PROTOCOL_EXTRA +#endif +#if !defined(SWIFT_EXTENSION) +# define SWIFT_EXTENSION(M) SWIFT_PASTE(M##_Swift_, __LINE__) +#endif +#if !defined(OBJC_DESIGNATED_INITIALIZER) +# if __has_attribute(objc_designated_initializer) +# define OBJC_DESIGNATED_INITIALIZER __attribute__((objc_designated_initializer)) +# else +# define OBJC_DESIGNATED_INITIALIZER +# endif +#endif +#if !defined(SWIFT_ENUM_ATTR) +# if __has_attribute(enum_extensibility) +# define SWIFT_ENUM_ATTR(_extensibility) __attribute__((enum_extensibility(_extensibility))) +# else +# define SWIFT_ENUM_ATTR(_extensibility) +# endif +#endif +#if !defined(SWIFT_ENUM) +# define SWIFT_ENUM(_type, _name, _extensibility) enum _name : _type _name; enum SWIFT_ENUM_ATTR(_extensibility) SWIFT_ENUM_EXTRA _name : _type +# if __has_feature(generalized_swift_name) +# define SWIFT_ENUM_NAMED(_type, _name, SWIFT_NAME, _extensibility) enum _name : _type _name SWIFT_COMPILE_NAME(SWIFT_NAME); enum SWIFT_COMPILE_NAME(SWIFT_NAME) SWIFT_ENUM_ATTR(_extensibility) SWIFT_ENUM_EXTRA _name : _type +# else +# define SWIFT_ENUM_NAMED(_type, _name, SWIFT_NAME, _extensibility) SWIFT_ENUM(_type, _name, _extensibility) +# endif +#endif +#if !defined(SWIFT_UNAVAILABLE) +# define SWIFT_UNAVAILABLE __attribute__((unavailable)) +#endif +#if !defined(SWIFT_UNAVAILABLE_MSG) +# define SWIFT_UNAVAILABLE_MSG(msg) __attribute__((unavailable(msg))) +#endif +#if !defined(SWIFT_AVAILABILITY) +# define SWIFT_AVAILABILITY(plat, ...) __attribute__((availability(plat, __VA_ARGS__))) +#endif +#if !defined(SWIFT_WEAK_IMPORT) +# define SWIFT_WEAK_IMPORT __attribute__((weak_import)) +#endif +#if !defined(SWIFT_DEPRECATED) +# define SWIFT_DEPRECATED __attribute__((deprecated)) +#endif +#if !defined(SWIFT_DEPRECATED_MSG) +# define SWIFT_DEPRECATED_MSG(...) __attribute__((deprecated(__VA_ARGS__))) +#endif +#if !defined(SWIFT_DEPRECATED_OBJC) +# if __has_feature(attribute_diagnose_if_objc) +# define SWIFT_DEPRECATED_OBJC(Msg) __attribute__((diagnose_if(1, Msg, "warning"))) +# else +# define SWIFT_DEPRECATED_OBJC(Msg) SWIFT_DEPRECATED_MSG(Msg) +# endif +#endif +#if defined(__OBJC__) +#if !defined(IBSegueAction) +# define IBSegueAction +#endif +#endif +#if !defined(SWIFT_EXTERN) +# if defined(__cplusplus) +# define SWIFT_EXTERN extern "C" +# else +# define SWIFT_EXTERN extern +# endif +#endif +#if !defined(SWIFT_CALL) +# define SWIFT_CALL __attribute__((swiftcall)) +#endif +#if !defined(SWIFT_INDIRECT_RESULT) +# define SWIFT_INDIRECT_RESULT __attribute__((swift_indirect_result)) +#endif +#if !defined(SWIFT_CONTEXT) +# define SWIFT_CONTEXT __attribute__((swift_context)) +#endif +#if !defined(SWIFT_ERROR_RESULT) +# define SWIFT_ERROR_RESULT __attribute__((swift_error_result)) +#endif +#if defined(__cplusplus) +# define SWIFT_NOEXCEPT noexcept +#else +# define SWIFT_NOEXCEPT +#endif +#if !defined(SWIFT_C_INLINE_THUNK) +# if __has_attribute(always_inline) +# if __has_attribute(nodebug) +# define SWIFT_C_INLINE_THUNK inline __attribute__((always_inline)) __attribute__((nodebug)) +# else +# define SWIFT_C_INLINE_THUNK inline __attribute__((always_inline)) +# endif +# else +# define SWIFT_C_INLINE_THUNK inline +# endif +#endif +#if defined(_WIN32) +#if !defined(SWIFT_IMPORT_STDLIB_SYMBOL) +# define SWIFT_IMPORT_STDLIB_SYMBOL __declspec(dllimport) +#endif +#else +#if !defined(SWIFT_IMPORT_STDLIB_SYMBOL) +# define SWIFT_IMPORT_STDLIB_SYMBOL +#endif +#endif +#if defined(__OBJC__) +#if __has_feature(objc_modules) +#if __has_warning("-Watimport-in-framework-header") +#pragma clang diagnostic ignored "-Watimport-in-framework-header" +#endif +@import Foundation; +@import ObjectiveC; +#endif + +#endif +#pragma clang diagnostic ignored "-Wproperty-attribute-mismatch" +#pragma clang diagnostic ignored "-Wduplicate-method-arg" +#if __has_warning("-Wpragma-clang-attribute") +# pragma clang diagnostic ignored "-Wpragma-clang-attribute" +#endif +#pragma clang diagnostic ignored "-Wunknown-pragmas" +#pragma clang diagnostic ignored "-Wnullability" +#pragma clang diagnostic ignored "-Wdollar-in-identifier-extension" +#pragma clang diagnostic ignored "-Wunsafe-buffer-usage" + +#if __has_attribute(external_source_symbol) +# pragma push_macro("any") +# undef any +# pragma clang attribute push(__attribute__((external_source_symbol(language="Swift", defined_in="AVFAudioWrapper",generated_declaration))), apply_to=any(function,enum,objc_interface,objc_category,objc_protocol)) +# pragma pop_macro("any") +#endif + +#if defined(__OBJC__) + +SWIFT_CLASS("_TtC15AVFAudioWrapper22AVAUPresetEventWrapper") +@interface AVAUPresetEventWrapper : NSObject +- (nonnull instancetype)init SWIFT_UNAVAILABLE; ++ (nonnull instancetype)new SWIFT_UNAVAILABLE_MSG("-init is unavailable"); +@end + + +SWIFT_CLASS("_TtC15AVFAudioWrapper34AVAudio3DAngularOrientationWrapper") +@interface AVAudio3DAngularOrientationWrapper : NSObject +@property (nonatomic) float pitch; +@property (nonatomic) float roll; +@property (nonatomic) float yaw; +- (nonnull instancetype)initWithYaw:(float)yaw pitch:(float)pitch roll:(float)roll OBJC_DESIGNATED_INITIALIZER; +- (nonnull instancetype)init OBJC_DESIGNATED_INITIALIZER; +@end + + +SWIFT_CLASS("_TtC15AVFAudioWrapper21AVAudio3DPointWrapper") +@interface AVAudio3DPointWrapper : NSObject +@property (nonatomic) float x; +@property (nonatomic) float y; +@property (nonatomic) float z; +- (nonnull instancetype)initWithX:(float)x y:(float)y z:(float)z OBJC_DESIGNATED_INITIALIZER; +- (nonnull instancetype)init OBJC_DESIGNATED_INITIALIZER; +@end + + +SWIFT_CLASS("_TtC15AVFAudioWrapper33AVAudio3DVectorOrientationWrapper") +@interface AVAudio3DVectorOrientationWrapper : NSObject +- (nonnull instancetype)init OBJC_DESIGNATED_INITIALIZER; +@end + +@class NSString; + +SWIFT_CLASS("_TtC15AVFAudioWrapper25AVAudioApplicationWrapper") +@interface AVAudioApplicationWrapper : NSObject +SWIFT_CLASS_PROPERTY(@property (nonatomic, class, readonly, copy) NSString * _Nonnull muteStateKey;) ++ (NSString * _Nonnull)muteStateKey SWIFT_WARN_UNUSED_RESULT; +SWIFT_CLASS_PROPERTY(@property (nonatomic, class, readonly, strong) AVAudioApplicationWrapper * _Nonnull shared;) ++ (AVAudioApplicationWrapper * _Nonnull)shared SWIFT_WARN_UNUSED_RESULT; +@property (nonatomic, readonly) BOOL isInputMuted; +- (BOOL)setInputMuted:(BOOL)muted error:(NSError * _Nullable * _Nullable)error; +- (nonnull instancetype)init SWIFT_UNAVAILABLE; ++ (nonnull instancetype)new SWIFT_UNAVAILABLE_MSG("-init is unavailable"); +@end + +@class AVAudioFormatWrapper; + +SWIFT_CLASS("_TtC15AVFAudioWrapper20AVAudioBufferWrapper") +@interface AVAudioBufferWrapper : NSObject +@property (nonatomic, readonly, strong) AVAudioFormatWrapper * _Nonnull format; +- (nonnull instancetype)init SWIFT_UNAVAILABLE; ++ (nonnull instancetype)new SWIFT_UNAVAILABLE_MSG("-init is unavailable"); +@end + + +SWIFT_CLASS("_TtC15AVFAudioWrapper27AVAudioChannelLayoutWrapper") +@interface AVAudioChannelLayoutWrapper : NSObject +- (nonnull instancetype)init SWIFT_UNAVAILABLE; ++ (nonnull instancetype)new SWIFT_UNAVAILABLE_MSG("-init is unavailable"); +@end + + +SWIFT_CLASS("_TtC15AVFAudioWrapper30AVAudioCompressedBufferWrapper") +@interface AVAudioCompressedBufferWrapper : NSObject +@property (nonatomic, readonly) NSInteger maximumPacketSize; +- (nonnull instancetype)init SWIFT_UNAVAILABLE; ++ (nonnull instancetype)new SWIFT_UNAVAILABLE_MSG("-init is unavailable"); +@end + +@class AVAudioNodeWrapper; + +SWIFT_CLASS("_TtC15AVFAudioWrapper29AVAudioConnectionPointWrapper") +@interface AVAudioConnectionPointWrapper : NSObject +@property (nonatomic, readonly, strong) AVAudioNodeWrapper * _Nullable node; +- (nonnull instancetype)init SWIFT_UNAVAILABLE; ++ (nonnull instancetype)new SWIFT_UNAVAILABLE_MSG("-init is unavailable"); +@end + + +SWIFT_CLASS("_TtC15AVFAudioWrapper32AVAudioConverterPrimeInfoWrapper") +@interface AVAudioConverterPrimeInfoWrapper : NSObject +- (nonnull instancetype)init OBJC_DESIGNATED_INITIALIZER; +@end + +@class AVAudioPCMBufferWrapper; + +SWIFT_CLASS("_TtC15AVFAudioWrapper23AVAudioConverterWrapper") +@interface AVAudioConverterWrapper : NSObject +@property (nonatomic) NSInteger bitRate; +@property (nonatomic, copy) NSString * _Nullable bitRateStrategy; +@property (nonatomic) BOOL dither; +@property (nonatomic) BOOL downmix; +@property (nonatomic, readonly, strong) AVAudioFormatWrapper * _Nonnull inputFormat; +@property (nonatomic, readonly) NSInteger maximumOutputPacketSize; +@property (nonatomic, readonly, strong) AVAudioFormatWrapper * _Nonnull outputFormat; +@property (nonatomic, strong) AVAudioConverterPrimeInfoWrapper * _Nonnull primeInfo; +@property (nonatomic, copy) NSString * _Nullable sampleRateConverterAlgorithm; +@property (nonatomic) NSInteger sampleRateConverterQuality; +- (nullable instancetype)initFrom:(AVAudioFormatWrapper * _Nonnull)fromFormat to:(AVAudioFormatWrapper * _Nonnull)toFormat OBJC_DESIGNATED_INITIALIZER; +- (BOOL)convertTo:(AVAudioPCMBufferWrapper * _Nonnull)outputBuffer from:(AVAudioPCMBufferWrapper * _Nonnull)inputBuffer error:(NSError * _Nullable * _Nullable)error; +- (void)reset; +- (nonnull instancetype)init SWIFT_UNAVAILABLE; ++ (nonnull instancetype)new SWIFT_UNAVAILABLE_MSG("-init is unavailable"); +@end + +@class AVAudioInputNodeWrapper; +@class AVAudioMixerNodeWrapper; +@class AVAudioOutputNodeWrapper; + +SWIFT_CLASS("_TtC15AVFAudioWrapper20AVAudioEngineWrapper") +@interface AVAudioEngineWrapper : NSObject +@property (nonatomic) BOOL isAutoShutdownEnabled; +@property (nonatomic, readonly, strong) AVAudioInputNodeWrapper * _Nonnull inputNode; +@property (nonatomic, readonly) BOOL isInManualRenderingMode; +@property (nonatomic, readonly, strong) AVAudioMixerNodeWrapper * _Nonnull mainMixerNode; +@property (nonatomic, readonly, strong) AVAudioFormatWrapper * _Nonnull manualRenderingFormat; +@property (nonatomic, readonly, strong) AVAudioOutputNodeWrapper * _Nonnull outputNode; +@property (nonatomic, readonly) BOOL isRunning; +- (nonnull instancetype)init OBJC_DESIGNATED_INITIALIZER; +- (void)attach:(AVAudioNodeWrapper * _Nonnull)node; +- (void)connect:(AVAudioNodeWrapper * _Nonnull)node1 to:(AVAudioNodeWrapper * _Nonnull)node2 format:(AVAudioFormatWrapper * _Nullable)format; +- (void)detach:(AVAudioNodeWrapper * _Nonnull)node; +- (void)disableManualRenderingMode; +- (void)disconnectMIDI:(AVAudioNodeWrapper * _Nonnull)sourceNode from:(AVAudioNodeWrapper * _Nonnull)destinationNode; +- (void)disconnectMIDIInput:(AVAudioNodeWrapper * _Nonnull)node; +- (void)disconnectMIDIOutput:(AVAudioNodeWrapper * _Nonnull)node; +- (void)disconnectNodeInput:(AVAudioNodeWrapper * _Nonnull)node; +- (void)disconnectNodeOutput:(AVAudioNodeWrapper * _Nonnull)node; +- (void)pause; +- (void)prepare; +- (void)reset; +- (BOOL)startAndReturnError:(NSError * _Nullable * _Nullable)error; +- (void)stop; +@end + + +SWIFT_CLASS("_TtC15AVFAudioWrapper54AVAudioEnvironmentDistanceAttenuationParametersWrapper") +@interface AVAudioEnvironmentDistanceAttenuationParametersWrapper : NSObject +@property (nonatomic) float maximumDistance; +@property (nonatomic) float referenceDistance; +@property (nonatomic) float rolloffFactor; +- (nonnull instancetype)init SWIFT_UNAVAILABLE; ++ (nonnull instancetype)new SWIFT_UNAVAILABLE_MSG("-init is unavailable"); +@end + +@class AVAudioEnvironmentReverbParametersWrapper; + +SWIFT_CLASS("_TtC15AVFAudioWrapper29AVAudioEnvironmentNodeWrapper") +@interface AVAudioEnvironmentNodeWrapper : NSObject +@property (nonatomic, readonly, strong) AVAudioEnvironmentDistanceAttenuationParametersWrapper * _Nonnull distanceAttenuationParameters; +@property (nonatomic, strong) AVAudio3DAngularOrientationWrapper * _Nonnull listenerAngularOrientation; +@property (nonatomic, strong) AVAudio3DPointWrapper * _Nonnull listenerPosition; +@property (nonatomic, strong) AVAudio3DVectorOrientationWrapper * _Nonnull listenerVectorOrientation; +@property (nonatomic) float outputVolume; +@property (nonatomic, readonly, strong) AVAudioEnvironmentReverbParametersWrapper * _Nonnull reverbParameters; +- (nonnull instancetype)init OBJC_DESIGNATED_INITIALIZER; +@end + +@class AVAudioUnitEQFilterParametersWrapper; + +SWIFT_CLASS("_TtC15AVFAudioWrapper41AVAudioEnvironmentReverbParametersWrapper") +@interface AVAudioEnvironmentReverbParametersWrapper : NSObject +@property (nonatomic) BOOL enable; +@property (nonatomic, readonly, strong) AVAudioUnitEQFilterParametersWrapper * _Nonnull filterParameters; +@property (nonatomic) float level; +- (nonnull instancetype)init SWIFT_UNAVAILABLE; ++ (nonnull instancetype)new SWIFT_UNAVAILABLE_MSG("-init is unavailable"); +@end + +@class NSURL; + +SWIFT_CLASS("_TtC15AVFAudioWrapper18AVAudioFileWrapper") +@interface AVAudioFileWrapper : NSObject +@property (nonatomic, readonly, strong) AVAudioFormatWrapper * _Nonnull fileFormat; +@property (nonatomic, readonly, strong) AVAudioFormatWrapper * _Nonnull processingFormat; +@property (nonatomic, readonly, copy) NSURL * _Nonnull url; +- (nullable instancetype)initForReading:(NSURL * _Nonnull)fileURL error:(NSError * _Nullable * _Nullable)error OBJC_DESIGNATED_INITIALIZER; +- (BOOL)readInto:(AVAudioPCMBufferWrapper * _Nonnull)buffer error:(NSError * _Nullable * _Nullable)error; +- (BOOL)writeFrom:(AVAudioPCMBufferWrapper * _Nonnull)buffer error:(NSError * _Nullable * _Nullable)error; +- (nonnull instancetype)init SWIFT_UNAVAILABLE; ++ (nonnull instancetype)new SWIFT_UNAVAILABLE_MSG("-init is unavailable"); +@end + + +SWIFT_CLASS("_TtC15AVFAudioWrapper20AVAudioFormatWrapper") +@interface AVAudioFormatWrapper : NSObject +@property (nonatomic, readonly, strong) AVAudioChannelLayoutWrapper * _Nullable channelLayout; +@property (nonatomic, readonly) BOOL isInterleaved; +@property (nonatomic, readonly) double sampleRate; +@property (nonatomic, readonly) BOOL isStandard; +- (nonnull instancetype)initWithStandardFormatWithSampleRate:(double)sampleRate channelLayout:(AVAudioChannelLayoutWrapper * _Nonnull)layout OBJC_DESIGNATED_INITIALIZER; +- (nonnull instancetype)init SWIFT_UNAVAILABLE; ++ (nonnull instancetype)new SWIFT_UNAVAILABLE_MSG("-init is unavailable"); +@end + + +SWIFT_CLASS("_TtC15AVFAudioWrapper20AVAudioIONodeWrapper") +@interface AVAudioIONodeWrapper : NSObject +@property (nonatomic, readonly) NSTimeInterval presentationLatency; +@property (nonatomic, readonly) BOOL isVoiceProcessingEnabled; +- (BOOL)setVoiceProcessingEnabled:(BOOL)enabled error:(NSError * _Nullable * _Nullable)error; +- (nonnull instancetype)init SWIFT_UNAVAILABLE; ++ (nonnull instancetype)new SWIFT_UNAVAILABLE_MSG("-init is unavailable"); +@end + +@class AVAudioVoiceProcessingOtherAudioDuckingConfigurationWrapper; + +SWIFT_CLASS("_TtC15AVFAudioWrapper23AVAudioInputNodeWrapper") +@interface AVAudioInputNodeWrapper : NSObject +@property (nonatomic) BOOL isVoiceProcessingAGCEnabled; +@property (nonatomic) BOOL isVoiceProcessingBypassed; +@property (nonatomic) BOOL isVoiceProcessingInputMuted; +@property (nonatomic, strong) AVAudioVoiceProcessingOtherAudioDuckingConfigurationWrapper * _Nonnull voiceProcessingOtherAudioDuckingConfiguration; +- (nonnull instancetype)init SWIFT_UNAVAILABLE; ++ (nonnull instancetype)new SWIFT_UNAVAILABLE_MSG("-init is unavailable"); +@end + + +SWIFT_CLASS("_TtC15AVFAudioWrapper23AVAudioMixerNodeWrapper") +@interface AVAudioMixerNodeWrapper : NSObject +@property (nonatomic) float outputVolume; +- (nonnull instancetype)init OBJC_DESIGNATED_INITIALIZER; +@end + + +SWIFT_CLASS("_TtC15AVFAudioWrapper31AVAudioMixingDestinationWrapper") +@interface AVAudioMixingDestinationWrapper : NSObject +@property (nonatomic, readonly, strong) AVAudioConnectionPointWrapper * _Nonnull connectionPoint; +- (nonnull instancetype)init SWIFT_UNAVAILABLE; ++ (nonnull instancetype)new SWIFT_UNAVAILABLE_MSG("-init is unavailable"); +@end + +@class AVAudioTimeWrapper; + +SWIFT_CLASS("_TtC15AVFAudioWrapper18AVAudioNodeWrapper") +@interface AVAudioNodeWrapper : NSObject +@property (nonatomic, readonly, strong) AVAudioEngineWrapper * _Nullable engine; +@property (nonatomic, readonly, strong) AVAudioTimeWrapper * _Nullable lastRenderTime; +@property (nonatomic, readonly) NSTimeInterval latency; +@property (nonatomic, readonly) NSInteger numberOfInputs; +@property (nonatomic, readonly) NSInteger numberOfOutputs; +@property (nonatomic, readonly) NSTimeInterval outputPresentationLatency; +- (void)reset; +- (nonnull instancetype)init SWIFT_UNAVAILABLE; ++ (nonnull instancetype)new SWIFT_UNAVAILABLE_MSG("-init is unavailable"); +@end + + +SWIFT_CLASS("_TtC15AVFAudioWrapper24AVAudioOutputNodeWrapper") +@interface AVAudioOutputNodeWrapper : NSObject +- (nonnull instancetype)init SWIFT_UNAVAILABLE; ++ (nonnull instancetype)new SWIFT_UNAVAILABLE_MSG("-init is unavailable"); +@end + + +SWIFT_CLASS("_TtC15AVFAudioWrapper23AVAudioPCMBufferWrapper") +@interface AVAudioPCMBufferWrapper : NSObject +@property (nonatomic, readonly) NSInteger stride; +- (nonnull instancetype)init SWIFT_UNAVAILABLE; ++ (nonnull instancetype)new SWIFT_UNAVAILABLE_MSG("-init is unavailable"); +@end + + +SWIFT_CLASS("_TtC15AVFAudioWrapper37AVAudioPlayerNodeBufferOptionsWrapper") +@interface AVAudioPlayerNodeBufferOptionsWrapper : NSObject +SWIFT_CLASS_PROPERTY(@property (nonatomic, class, readonly, strong) AVAudioPlayerNodeBufferOptionsWrapper * _Nonnull interrupts;) ++ (AVAudioPlayerNodeBufferOptionsWrapper * _Nonnull)interrupts SWIFT_WARN_UNUSED_RESULT; +SWIFT_CLASS_PROPERTY(@property (nonatomic, class, readonly, strong) AVAudioPlayerNodeBufferOptionsWrapper * _Nonnull interruptsAtLoop;) ++ (AVAudioPlayerNodeBufferOptionsWrapper * _Nonnull)interruptsAtLoop SWIFT_WARN_UNUSED_RESULT; +SWIFT_CLASS_PROPERTY(@property (nonatomic, class, readonly, strong) AVAudioPlayerNodeBufferOptionsWrapper * _Nonnull loops;) ++ (AVAudioPlayerNodeBufferOptionsWrapper * _Nonnull)loops SWIFT_WARN_UNUSED_RESULT; +@property (nonatomic, readonly) BOOL isEmpty; +- (nonnull instancetype)init OBJC_DESIGNATED_INITIALIZER; +@end + + +SWIFT_CLASS("_TtC15AVFAudioWrapper24AVAudioPlayerNodeWrapper") +@interface AVAudioPlayerNodeWrapper : NSObject +@property (nonatomic, readonly) BOOL isPlaying; +- (nonnull instancetype)init OBJC_DESIGNATED_INITIALIZER; +- (AVAudioTimeWrapper * _Nullable)nodeTimeForPlayerTime:(AVAudioTimeWrapper * _Nonnull)playerTime SWIFT_WARN_UNUSED_RESULT; +- (void)pause; +- (void)play; +- (void)playAt:(AVAudioTimeWrapper * _Nullable)when; +- (AVAudioTimeWrapper * _Nullable)playerTimeForNodeTime:(AVAudioTimeWrapper * _Nonnull)nodeTime SWIFT_WARN_UNUSED_RESULT; +- (void)scheduleBuffer:(AVAudioPCMBufferWrapper * _Nonnull)buffer completionHandler:(void (^ _Nonnull)(void))completionHandler; +- (void)scheduleFile:(AVAudioFileWrapper * _Nonnull)file at:(AVAudioTimeWrapper * _Nullable)when completionHandler:(void (^ _Nonnull)(void))completionHandler; +- (void)stop; +@end + + +SWIFT_CLASS("_TtC15AVFAudioWrapper20AVAudioPlayerWrapper") +@interface AVAudioPlayerWrapper : NSObject +@property (nonatomic, copy) NSString * _Nullable currentDevice; +@property (nonatomic) NSTimeInterval currentTime; +@property (nonatomic, readonly) NSTimeInterval deviceCurrentTime; +@property (nonatomic, readonly) NSTimeInterval duration; +@property (nonatomic) BOOL enableRate; +@property (nonatomic, readonly, strong) AVAudioFormatWrapper * _Nonnull format; +@property (nonatomic) BOOL isMeteringEnabled; +@property (nonatomic, readonly) NSInteger numberOfChannels; +@property (nonatomic) NSInteger numberOfLoops; +@property (nonatomic) float pan; +@property (nonatomic, readonly) BOOL isPlaying; +@property (nonatomic) float rate; +@property (nonatomic, readonly, copy) NSURL * _Nullable url; +@property (nonatomic) float volume; +- (nullable instancetype)initWithContentsOf:(NSURL * _Nonnull)url error:(NSError * _Nullable * _Nullable)error OBJC_DESIGNATED_INITIALIZER; +- (nullable instancetype)initWithContentsOf:(NSURL * _Nonnull)url fileTypeHint:(NSString * _Nullable)utiString error:(NSError * _Nullable * _Nullable)error OBJC_DESIGNATED_INITIALIZER; +- (float)averagePowerForChannel:(NSInteger)channelNumber SWIFT_WARN_UNUSED_RESULT; +- (void)pause; +- (float)peakPowerForChannel:(NSInteger)channelNumber SWIFT_WARN_UNUSED_RESULT; +- (BOOL)play SWIFT_WARN_UNUSED_RESULT; +- (BOOL)playAtTime:(NSTimeInterval)time SWIFT_WARN_UNUSED_RESULT; +- (BOOL)prepareToPlay SWIFT_WARN_UNUSED_RESULT; +- (void)setVolume:(float)volume fadeDuration:(NSTimeInterval)duration; +- (void)stop; +- (void)updateMeters; +- (nonnull instancetype)init SWIFT_UNAVAILABLE; ++ (nonnull instancetype)new SWIFT_UNAVAILABLE_MSG("-init is unavailable"); +@end + + +SWIFT_CLASS("_TtC15AVFAudioWrapper22AVAudioRecorderWrapper") +@interface AVAudioRecorderWrapper : NSObject +@property (nonatomic, readonly) NSTimeInterval currentTime; +@property (nonatomic, readonly) NSTimeInterval deviceCurrentTime; +@property (nonatomic, readonly, strong) AVAudioFormatWrapper * _Nonnull format; +@property (nonatomic) BOOL isMeteringEnabled; +@property (nonatomic, readonly) BOOL isRecording; +@property (nonatomic, readonly, copy) NSURL * _Nonnull url; +- (nullable instancetype)initWithUrl:(NSURL * _Nonnull)url format:(AVAudioFormatWrapper * _Nonnull)format error:(NSError * _Nullable * _Nullable)error OBJC_DESIGNATED_INITIALIZER; +- (float)averagePowerForChannel:(NSInteger)channelNumber SWIFT_WARN_UNUSED_RESULT; +- (BOOL)deleteRecording SWIFT_WARN_UNUSED_RESULT; +- (void)pause; +- (float)peakPowerForChannel:(NSInteger)channelNumber SWIFT_WARN_UNUSED_RESULT; +- (BOOL)prepareToRecord SWIFT_WARN_UNUSED_RESULT; +- (BOOL)record SWIFT_WARN_UNUSED_RESULT; +- (BOOL)recordAtTime:(NSTimeInterval)time SWIFT_WARN_UNUSED_RESULT; +- (BOOL)recordAtTime:(NSTimeInterval)time forDuration:(NSTimeInterval)duration SWIFT_WARN_UNUSED_RESULT; +- (BOOL)recordForDuration:(NSTimeInterval)duration SWIFT_WARN_UNUSED_RESULT; +- (void)stop; +- (void)updateMeters; +- (nonnull instancetype)init SWIFT_UNAVAILABLE; ++ (nonnull instancetype)new SWIFT_UNAVAILABLE_MSG("-init is unavailable"); +@end + + +SWIFT_CLASS("_TtC15AVFAudioWrapper28AVAudioRoutingArbiterWrapper") +@interface AVAudioRoutingArbiterWrapper : NSObject +SWIFT_CLASS_PROPERTY(@property (nonatomic, class, readonly, strong) AVAudioRoutingArbiterWrapper * _Nonnull shared;) ++ (AVAudioRoutingArbiterWrapper * _Nonnull)shared SWIFT_WARN_UNUSED_RESULT; +- (void)leave; +- (nonnull instancetype)init SWIFT_UNAVAILABLE; ++ (nonnull instancetype)new SWIFT_UNAVAILABLE_MSG("-init is unavailable"); +@end + +@class AVMusicTrackWrapper; + +SWIFT_CLASS("_TtC15AVFAudioWrapper23AVAudioSequencerWrapper") +@interface AVAudioSequencerWrapper : NSObject +@property (nonatomic) NSTimeInterval currentPositionInBeats; +@property (nonatomic) NSTimeInterval currentPositionInSeconds; +@property (nonatomic, readonly) BOOL isPlaying; +@property (nonatomic) float rate; +@property (nonatomic, readonly, strong) AVMusicTrackWrapper * _Nonnull tempoTrack; +- (nonnull instancetype)init OBJC_DESIGNATED_INITIALIZER; +- (nonnull instancetype)initWithAudioEngine:(AVAudioEngineWrapper * _Nonnull)engine OBJC_DESIGNATED_INITIALIZER; +- (AVMusicTrackWrapper * _Nonnull)createAndAppendTrack SWIFT_WARN_UNUSED_RESULT; +- (void)prepareToPlay; +- (BOOL)removeTrack:(AVMusicTrackWrapper * _Nonnull)track SWIFT_WARN_UNUSED_RESULT; +- (void)reverseEvents; +- (BOOL)startAndReturnError:(NSError * _Nullable * _Nullable)error; +- (void)stop; +- (BOOL)writeTo:(NSURL * _Nonnull)fileURL smpteResolution:(NSInteger)resolution replaceExisting:(BOOL)replace error:(NSError * _Nullable * _Nullable)error; +@end + + +SWIFT_CLASS("_TtCC15AVFAudioWrapper23AVAudioSequencerWrapper24InfoDictionaryKeyWrapper") +@interface InfoDictionaryKeyWrapper : NSObject +SWIFT_CLASS_PROPERTY(@property (nonatomic, class, readonly, strong) InfoDictionaryKeyWrapper * _Nonnull album;) ++ (InfoDictionaryKeyWrapper * _Nonnull)album SWIFT_WARN_UNUSED_RESULT; +SWIFT_CLASS_PROPERTY(@property (nonatomic, class, readonly, strong) InfoDictionaryKeyWrapper * _Nonnull approximateDurationInSeconds;) ++ (InfoDictionaryKeyWrapper * _Nonnull)approximateDurationInSeconds SWIFT_WARN_UNUSED_RESULT; +SWIFT_CLASS_PROPERTY(@property (nonatomic, class, readonly, strong) InfoDictionaryKeyWrapper * _Nonnull artist;) ++ (InfoDictionaryKeyWrapper * _Nonnull)artist SWIFT_WARN_UNUSED_RESULT; +SWIFT_CLASS_PROPERTY(@property (nonatomic, class, readonly, strong) InfoDictionaryKeyWrapper * _Nonnull channelLayout;) ++ (InfoDictionaryKeyWrapper * _Nonnull)channelLayout SWIFT_WARN_UNUSED_RESULT; +SWIFT_CLASS_PROPERTY(@property (nonatomic, class, readonly, strong) InfoDictionaryKeyWrapper * _Nonnull comments;) ++ (InfoDictionaryKeyWrapper * _Nonnull)comments SWIFT_WARN_UNUSED_RESULT; +SWIFT_CLASS_PROPERTY(@property (nonatomic, class, readonly, strong) InfoDictionaryKeyWrapper * _Nonnull composer;) ++ (InfoDictionaryKeyWrapper * _Nonnull)composer SWIFT_WARN_UNUSED_RESULT; +SWIFT_CLASS_PROPERTY(@property (nonatomic, class, readonly, strong) InfoDictionaryKeyWrapper * _Nonnull copyright;) ++ (InfoDictionaryKeyWrapper * _Nonnull)copyright SWIFT_WARN_UNUSED_RESULT; +SWIFT_CLASS_PROPERTY(@property (nonatomic, class, readonly, strong) InfoDictionaryKeyWrapper * _Nonnull encodingApplication;) ++ (InfoDictionaryKeyWrapper * _Nonnull)encodingApplication SWIFT_WARN_UNUSED_RESULT; +SWIFT_CLASS_PROPERTY(@property (nonatomic, class, readonly, strong) InfoDictionaryKeyWrapper * _Nonnull genre;) ++ (InfoDictionaryKeyWrapper * _Nonnull)genre SWIFT_WARN_UNUSED_RESULT; +SWIFT_CLASS_PROPERTY(@property (nonatomic, class, readonly, strong) InfoDictionaryKeyWrapper * _Nonnull ISRC;) ++ (InfoDictionaryKeyWrapper * _Nonnull)ISRC SWIFT_WARN_UNUSED_RESULT; +SWIFT_CLASS_PROPERTY(@property (nonatomic, class, readonly, strong) InfoDictionaryKeyWrapper * _Nonnull keySignature;) ++ (InfoDictionaryKeyWrapper * _Nonnull)keySignature SWIFT_WARN_UNUSED_RESULT; +SWIFT_CLASS_PROPERTY(@property (nonatomic, class, readonly, strong) InfoDictionaryKeyWrapper * _Nonnull lyricist;) ++ (InfoDictionaryKeyWrapper * _Nonnull)lyricist SWIFT_WARN_UNUSED_RESULT; +SWIFT_CLASS_PROPERTY(@property (nonatomic, class, readonly, strong) InfoDictionaryKeyWrapper * _Nonnull nominalBitRate;) ++ (InfoDictionaryKeyWrapper * _Nonnull)nominalBitRate SWIFT_WARN_UNUSED_RESULT; +SWIFT_CLASS_PROPERTY(@property (nonatomic, class, readonly, strong) InfoDictionaryKeyWrapper * _Nonnull recordedDate;) ++ (InfoDictionaryKeyWrapper * _Nonnull)recordedDate SWIFT_WARN_UNUSED_RESULT; +SWIFT_CLASS_PROPERTY(@property (nonatomic, class, readonly, strong) InfoDictionaryKeyWrapper * _Nonnull sourceBitDepth;) ++ (InfoDictionaryKeyWrapper * _Nonnull)sourceBitDepth SWIFT_WARN_UNUSED_RESULT; +SWIFT_CLASS_PROPERTY(@property (nonatomic, class, readonly, strong) InfoDictionaryKeyWrapper * _Nonnull sourceEncoder;) ++ (InfoDictionaryKeyWrapper * _Nonnull)sourceEncoder SWIFT_WARN_UNUSED_RESULT; +SWIFT_CLASS_PROPERTY(@property (nonatomic, class, readonly, strong) InfoDictionaryKeyWrapper * _Nonnull subTitle;) ++ (InfoDictionaryKeyWrapper * _Nonnull)subTitle SWIFT_WARN_UNUSED_RESULT; +SWIFT_CLASS_PROPERTY(@property (nonatomic, class, readonly, strong) InfoDictionaryKeyWrapper * _Nonnull tempo;) ++ (InfoDictionaryKeyWrapper * _Nonnull)tempo SWIFT_WARN_UNUSED_RESULT; +SWIFT_CLASS_PROPERTY(@property (nonatomic, class, readonly, strong) InfoDictionaryKeyWrapper * _Nonnull timeSignature;) ++ (InfoDictionaryKeyWrapper * _Nonnull)timeSignature SWIFT_WARN_UNUSED_RESULT; +SWIFT_CLASS_PROPERTY(@property (nonatomic, class, readonly, strong) InfoDictionaryKeyWrapper * _Nonnull title;) ++ (InfoDictionaryKeyWrapper * _Nonnull)title SWIFT_WARN_UNUSED_RESULT; +SWIFT_CLASS_PROPERTY(@property (nonatomic, class, readonly, strong) InfoDictionaryKeyWrapper * _Nonnull trackNumber;) ++ (InfoDictionaryKeyWrapper * _Nonnull)trackNumber SWIFT_WARN_UNUSED_RESULT; +SWIFT_CLASS_PROPERTY(@property (nonatomic, class, readonly, strong) InfoDictionaryKeyWrapper * _Nonnull year;) ++ (InfoDictionaryKeyWrapper * _Nonnull)year SWIFT_WARN_UNUSED_RESULT; +- (nonnull instancetype)initWithRawValue:(NSString * _Nonnull)rawValue OBJC_DESIGNATED_INITIALIZER; +- (nonnull instancetype)init SWIFT_UNAVAILABLE; ++ (nonnull instancetype)new SWIFT_UNAVAILABLE_MSG("-init is unavailable"); +@end + + +SWIFT_CLASS("_TtC15AVFAudioWrapper38AVAudioSessionActivationOptionsWrapper") +@interface AVAudioSessionActivationOptionsWrapper : NSObject +@property (nonatomic, readonly) BOOL isEmpty; +- (nonnull instancetype)init OBJC_DESIGNATED_INITIALIZER; +@end + + +SWIFT_CLASS("_TtC15AVFAudioWrapper22AVAudioSinkNodeWrapper") +@interface AVAudioSinkNodeWrapper : NSObject +- (nonnull instancetype)init SWIFT_UNAVAILABLE; ++ (nonnull instancetype)new SWIFT_UNAVAILABLE_MSG("-init is unavailable"); +@end + + +SWIFT_CLASS("_TtC15AVFAudioWrapper24AVAudioSourceNodeWrapper") +@interface AVAudioSourceNodeWrapper : NSObject +- (nonnull instancetype)init SWIFT_UNAVAILABLE; ++ (nonnull instancetype)new SWIFT_UNAVAILABLE_MSG("-init is unavailable"); +@end + + +SWIFT_CLASS("_TtC15AVFAudioWrapper18AVAudioTimeWrapper") +@interface AVAudioTimeWrapper : NSObject +@property (nonatomic, readonly) BOOL isHostTimeValid; +@property (nonatomic, readonly) double sampleRate; +@property (nonatomic, readonly) BOOL isSampleTimeValid; +- (AVAudioTimeWrapper * _Nullable)extrapolateTimeFromAnchor:(AVAudioTimeWrapper * _Nonnull)anchorTime SWIFT_WARN_UNUSED_RESULT; +- (nonnull instancetype)init SWIFT_UNAVAILABLE; ++ (nonnull instancetype)new SWIFT_UNAVAILABLE_MSG("-init is unavailable"); +@end + + +SWIFT_CLASS("_TtC15AVFAudioWrapper34AVAudioUnitComponentManagerWrapper") +@interface AVAudioUnitComponentManagerWrapper : NSObject +- (nonnull instancetype)init SWIFT_UNAVAILABLE; ++ (nonnull instancetype)new SWIFT_UNAVAILABLE_MSG("-init is unavailable"); +@end + + +SWIFT_CLASS("_TtC15AVFAudioWrapper27AVAudioUnitComponentWrapper") +@interface AVAudioUnitComponentWrapper : NSObject +@property (nonatomic, readonly, copy) NSURL * _Nullable componentURL; +@property (nonatomic, readonly) BOOL hasCustomView; +@property (nonatomic, readonly) BOOL hasMIDIInput; +@property (nonatomic, readonly) BOOL hasMIDIOutput; +@property (nonatomic, readonly, copy) NSURL * _Nullable iconURL; +@property (nonatomic, readonly, copy) NSString * _Nonnull localizedTypeName; +@property (nonatomic, readonly, copy) NSString * _Nonnull manufacturerName; +@property (nonatomic, readonly, copy) NSString * _Nonnull name; +@property (nonatomic, readonly) BOOL passesAUVal; +@property (nonatomic, readonly) BOOL isSandboxSafe; +@property (nonatomic, readonly, copy) NSString * _Nonnull typeName; +@property (nonatomic, readonly) NSInteger version; +@property (nonatomic, readonly, copy) NSString * _Nonnull versionString; +- (BOOL)supportsNumberInputChannels:(NSInteger)numInputChannels outputChannels:(NSInteger)numOutputChannels SWIFT_WARN_UNUSED_RESULT; +- (nonnull instancetype)init SWIFT_UNAVAILABLE; ++ (nonnull instancetype)new SWIFT_UNAVAILABLE_MSG("-init is unavailable"); +@end + + +SWIFT_CLASS("_TtC15AVFAudioWrapper23AVAudioUnitDelayWrapper") +@interface AVAudioUnitDelayWrapper : NSObject +@property (nonatomic) NSTimeInterval delayTime; +@property (nonatomic) float feedback; +@property (nonatomic) float lowPassCutoff; +@property (nonatomic) float wetDryMix; +- (nonnull instancetype)init SWIFT_UNAVAILABLE; ++ (nonnull instancetype)new SWIFT_UNAVAILABLE_MSG("-init is unavailable"); +@end + + +SWIFT_CLASS("_TtC15AVFAudioWrapper28AVAudioUnitDistortionWrapper") +@interface AVAudioUnitDistortionWrapper : NSObject +@property (nonatomic) float preGain; +@property (nonatomic) float wetDryMix; +- (nonnull instancetype)init SWIFT_UNAVAILABLE; ++ (nonnull instancetype)new SWIFT_UNAVAILABLE_MSG("-init is unavailable"); +@end + + +SWIFT_CLASS("_TtC15AVFAudioWrapper36AVAudioUnitEQFilterParametersWrapper") +@interface AVAudioUnitEQFilterParametersWrapper : NSObject +@property (nonatomic) float bandwidth; +@property (nonatomic) BOOL bypass; +@property (nonatomic) float frequency; +@property (nonatomic) float gain; +- (nonnull instancetype)init SWIFT_UNAVAILABLE; ++ (nonnull instancetype)new SWIFT_UNAVAILABLE_MSG("-init is unavailable"); +@end + + +SWIFT_CLASS("_TtC15AVFAudioWrapper20AVAudioUnitEQWrapper") +@interface AVAudioUnitEQWrapper : NSObject +@property (nonatomic) float globalGain; +- (nonnull instancetype)initWithNumberOfBands:(NSInteger)numberOfBands OBJC_DESIGNATED_INITIALIZER; +- (nonnull instancetype)init SWIFT_UNAVAILABLE; ++ (nonnull instancetype)new SWIFT_UNAVAILABLE_MSG("-init is unavailable"); +@end + + +SWIFT_CLASS("_TtC15AVFAudioWrapper24AVAudioUnitEffectWrapper") +@interface AVAudioUnitEffectWrapper : NSObject +@property (nonatomic) BOOL bypass; +- (nonnull instancetype)init SWIFT_UNAVAILABLE; ++ (nonnull instancetype)new SWIFT_UNAVAILABLE_MSG("-init is unavailable"); +@end + + +SWIFT_CLASS("_TtC15AVFAudioWrapper27AVAudioUnitGeneratorWrapper") +@interface AVAudioUnitGeneratorWrapper : NSObject +@property (nonatomic) BOOL bypass; +- (nonnull instancetype)init SWIFT_UNAVAILABLE; ++ (nonnull instancetype)new SWIFT_UNAVAILABLE_MSG("-init is unavailable"); +@end + + +SWIFT_CLASS("_TtC15AVFAudioWrapper32AVAudioUnitMIDIInstrumentWrapper") +@interface AVAudioUnitMIDIInstrumentWrapper : NSObject +- (nonnull instancetype)init SWIFT_UNAVAILABLE; ++ (nonnull instancetype)new SWIFT_UNAVAILABLE_MSG("-init is unavailable"); +@end + + +SWIFT_CLASS("_TtC15AVFAudioWrapper24AVAudioUnitReverbWrapper") +@interface AVAudioUnitReverbWrapper : NSObject +@property (nonatomic) float wetDryMix; +- (nonnull instancetype)init SWIFT_UNAVAILABLE; ++ (nonnull instancetype)new SWIFT_UNAVAILABLE_MSG("-init is unavailable"); +@end + + +SWIFT_CLASS("_TtC15AVFAudioWrapper25AVAudioUnitSamplerWrapper") +@interface AVAudioUnitSamplerWrapper : NSObject +@property (nonatomic) float globalTuning; +@property (nonatomic) float masterGain; +@property (nonatomic) float overallGain; +@property (nonatomic) float stereoPan; +- (BOOL)loadInstrumentAt:(NSURL * _Nonnull)instrumentURL error:(NSError * _Nullable * _Nullable)error; +- (nonnull instancetype)init SWIFT_UNAVAILABLE; ++ (nonnull instancetype)new SWIFT_UNAVAILABLE_MSG("-init is unavailable"); +@end + + +SWIFT_CLASS("_TtC15AVFAudioWrapper28AVAudioUnitTimeEffectWrapper") +@interface AVAudioUnitTimeEffectWrapper : NSObject +@property (nonatomic) BOOL bypass; +- (nonnull instancetype)init SWIFT_UNAVAILABLE; ++ (nonnull instancetype)new SWIFT_UNAVAILABLE_MSG("-init is unavailable"); +@end + + +SWIFT_CLASS("_TtC15AVFAudioWrapper27AVAudioUnitTimePitchWrapper") +@interface AVAudioUnitTimePitchWrapper : NSObject +@property (nonatomic) float overlap; +@property (nonatomic) float pitch; +@property (nonatomic) float rate; +- (nonnull instancetype)init SWIFT_UNAVAILABLE; ++ (nonnull instancetype)new SWIFT_UNAVAILABLE_MSG("-init is unavailable"); +@end + + +SWIFT_CLASS("_TtC15AVFAudioWrapper27AVAudioUnitVarispeedWrapper") +@interface AVAudioUnitVarispeedWrapper : NSObject +@property (nonatomic) float rate; +- (nonnull instancetype)init SWIFT_UNAVAILABLE; ++ (nonnull instancetype)new SWIFT_UNAVAILABLE_MSG("-init is unavailable"); +@end + + +SWIFT_CLASS("_TtC15AVFAudioWrapper18AVAudioUnitWrapper") +@interface AVAudioUnitWrapper : NSObject +@property (nonatomic, readonly, copy) NSString * _Nonnull manufacturerName; +@property (nonatomic, readonly, copy) NSString * _Nonnull name; +@property (nonatomic, readonly) NSInteger version; +- (BOOL)loadPresetAt:(NSURL * _Nonnull)url error:(NSError * _Nullable * _Nullable)error; +- (nonnull instancetype)init SWIFT_UNAVAILABLE; ++ (nonnull instancetype)new SWIFT_UNAVAILABLE_MSG("-init is unavailable"); +@end + + +SWIFT_CLASS("_TtC15AVFAudioWrapper59AVAudioVoiceProcessingOtherAudioDuckingConfigurationWrapper") +@interface AVAudioVoiceProcessingOtherAudioDuckingConfigurationWrapper : NSObject +- (nonnull instancetype)init OBJC_DESIGNATED_INITIALIZER; +@end + + +SWIFT_CLASS("_TtC15AVFAudioWrapper28AVExtendedNoteOnEventWrapper") +@interface AVExtendedNoteOnEventWrapper : NSObject +@property (nonatomic) float midiNote; +@property (nonatomic) float velocity; +- (nonnull instancetype)init SWIFT_UNAVAILABLE; ++ (nonnull instancetype)new SWIFT_UNAVAILABLE_MSG("-init is unavailable"); +@end + + +SWIFT_CLASS("_TtC15AVFAudioWrapper27AVExtendedTempoEventWrapper") +@interface AVExtendedTempoEventWrapper : NSObject +@property (nonatomic) double tempo; +- (nonnull instancetype)initWithTempo:(double)tempo OBJC_DESIGNATED_INITIALIZER; +- (nonnull instancetype)init SWIFT_UNAVAILABLE; ++ (nonnull instancetype)new SWIFT_UNAVAILABLE_MSG("-init is unavailable"); +@end + + +SWIFT_CLASS("_TtC15AVFAudioWrapper25AVMIDIChannelEventWrapper") +@interface AVMIDIChannelEventWrapper : NSObject +- (nonnull instancetype)init SWIFT_UNAVAILABLE; ++ (nonnull instancetype)new SWIFT_UNAVAILABLE_MSG("-init is unavailable"); +@end + + +SWIFT_CLASS("_TtC15AVFAudioWrapper33AVMIDIChannelPressureEventWrapper") +@interface AVMIDIChannelPressureEventWrapper : NSObject +- (nonnull instancetype)init SWIFT_UNAVAILABLE; ++ (nonnull instancetype)new SWIFT_UNAVAILABLE_MSG("-init is unavailable"); +@end + + +SWIFT_CLASS("_TtC15AVFAudioWrapper31AVMIDIControlChangeEventWrapper") +@interface AVMIDIControlChangeEventWrapper : NSObject +- (nonnull instancetype)init SWIFT_UNAVAILABLE; ++ (nonnull instancetype)new SWIFT_UNAVAILABLE_MSG("-init is unavailable"); +@end + + +SWIFT_CLASS("_TtC15AVFAudioWrapper22AVMIDIMetaEventWrapper") +@interface AVMIDIMetaEventWrapper : NSObject +- (nonnull instancetype)init SWIFT_UNAVAILABLE; ++ (nonnull instancetype)new SWIFT_UNAVAILABLE_MSG("-init is unavailable"); +@end + + +SWIFT_CLASS("_TtC15AVFAudioWrapper22AVMIDINoteEventWrapper") +@interface AVMIDINoteEventWrapper : NSObject +- (nonnull instancetype)init SWIFT_UNAVAILABLE; ++ (nonnull instancetype)new SWIFT_UNAVAILABLE_MSG("-init is unavailable"); +@end + + +SWIFT_CLASS("_TtC15AVFAudioWrapper27AVMIDIPitchBendEventWrapper") +@interface AVMIDIPitchBendEventWrapper : NSObject +- (nonnull instancetype)init SWIFT_UNAVAILABLE; ++ (nonnull instancetype)new SWIFT_UNAVAILABLE_MSG("-init is unavailable"); +@end + + +SWIFT_CLASS("_TtC15AVFAudioWrapper19AVMIDIPlayerWrapper") +@interface AVMIDIPlayerWrapper : NSObject +@property (nonatomic) NSTimeInterval currentPosition; +@property (nonatomic, readonly) NSTimeInterval duration; +@property (nonatomic, readonly) BOOL isPlaying; +@property (nonatomic) float rate; +- (nullable instancetype)initWithContentsOf:(NSURL * _Nonnull)inURL soundBankURL:(NSURL * _Nullable)bankURL error:(NSError * _Nullable * _Nullable)error OBJC_DESIGNATED_INITIALIZER; +- (void)prepareToPlay; +- (void)stop; +- (nonnull instancetype)init SWIFT_UNAVAILABLE; ++ (nonnull instancetype)new SWIFT_UNAVAILABLE_MSG("-init is unavailable"); +@end + + +SWIFT_CLASS("_TtC15AVFAudioWrapper30AVMIDIPolyPressureEventWrapper") +@interface AVMIDIPolyPressureEventWrapper : NSObject +- (nonnull instancetype)init SWIFT_UNAVAILABLE; ++ (nonnull instancetype)new SWIFT_UNAVAILABLE_MSG("-init is unavailable"); +@end + + +SWIFT_CLASS("_TtC15AVFAudioWrapper31AVMIDIProgramChangeEventWrapper") +@interface AVMIDIProgramChangeEventWrapper : NSObject +- (nonnull instancetype)init SWIFT_UNAVAILABLE; ++ (nonnull instancetype)new SWIFT_UNAVAILABLE_MSG("-init is unavailable"); +@end + + +SWIFT_CLASS("_TtC15AVFAudioWrapper23AVMIDISysexEventWrapper") +@interface AVMIDISysexEventWrapper : NSObject +- (nonnull instancetype)init SWIFT_UNAVAILABLE; ++ (nonnull instancetype)new SWIFT_UNAVAILABLE_MSG("-init is unavailable"); +@end + + +SWIFT_CLASS("_TtC15AVFAudioWrapper19AVMusicEventWrapper") +@interface AVMusicEventWrapper : NSObject +- (nonnull instancetype)init SWIFT_UNAVAILABLE; ++ (nonnull instancetype)new SWIFT_UNAVAILABLE_MSG("-init is unavailable"); +@end + + +SWIFT_CLASS("_TtC15AVFAudioWrapper33AVMusicSequenceLoadOptionsWrapper") +@interface AVMusicSequenceLoadOptionsWrapper : NSObject +SWIFT_CLASS_PROPERTY(@property (nonatomic, class, readonly, strong) AVMusicSequenceLoadOptionsWrapper * _Nonnull smf_ChannelsToTracks;) ++ (AVMusicSequenceLoadOptionsWrapper * _Nonnull)smf_ChannelsToTracks SWIFT_WARN_UNUSED_RESULT; +@property (nonatomic, readonly) BOOL isEmpty; +- (nonnull instancetype)init OBJC_DESIGNATED_INITIALIZER; +@end + + +SWIFT_CLASS("_TtC15AVFAudioWrapper19AVMusicTrackWrapper") +@interface AVMusicTrackWrapper : NSObject +@property (nonatomic, strong) AVAudioUnitWrapper * _Nullable destinationAudioUnit; +@property (nonatomic) NSTimeInterval lengthInSeconds; +@property (nonatomic) BOOL isLoopingEnabled; +@property (nonatomic) BOOL isMuted; +@property (nonatomic) NSInteger numberOfLoops; +@property (nonatomic) BOOL isSoloed; +@property (nonatomic, readonly) NSInteger timeResolution; +@property (nonatomic) BOOL usesAutomatedParameters; +- (nonnull instancetype)init SWIFT_UNAVAILABLE; ++ (nonnull instancetype)new SWIFT_UNAVAILABLE_MSG("-init is unavailable"); +@end + + +SWIFT_CLASS("_TtC15AVFAudioWrapper23AVMusicUserEventWrapper") +@interface AVMusicUserEventWrapper : NSObject +- (nonnull instancetype)init SWIFT_UNAVAILABLE; ++ (nonnull instancetype)new SWIFT_UNAVAILABLE_MSG("-init is unavailable"); +@end + + +SWIFT_CLASS("_TtC15AVFAudioWrapper23AVParameterEventWrapper") +@interface AVParameterEventWrapper : NSObject +@property (nonatomic) float value; +- (nonnull instancetype)init SWIFT_UNAVAILABLE; ++ (nonnull instancetype)new SWIFT_UNAVAILABLE_MSG("-init is unavailable"); +@end + + +SWIFT_CLASS("_TtC15AVFAudioWrapper30AVSpeechSynthesisMarkerWrapper") +@interface AVSpeechSynthesisMarkerWrapper : NSObject +@property (nonatomic, copy) NSString * _Nonnull bookmarkName; +@property (nonatomic) NSInteger byteSampleOffset; +@property (nonatomic, copy) NSString * _Nonnull phoneme; +- (nonnull instancetype)initWithBookmarkName:(NSString * _Nonnull)mark atByteSampleOffset:(NSInteger)byteSampleOffset OBJC_DESIGNATED_INITIALIZER; +- (nonnull instancetype)initWithPhonemeString:(NSString * _Nonnull)phoneme atByteSampleOffset:(NSInteger)byteSampleOffset OBJC_DESIGNATED_INITIALIZER; +- (nonnull instancetype)init SWIFT_UNAVAILABLE; ++ (nonnull instancetype)new SWIFT_UNAVAILABLE_MSG("-init is unavailable"); +@end + +@class AVSpeechSynthesisProviderRequestWrapper; + +SWIFT_CLASS("_TtC15AVFAudioWrapper41AVSpeechSynthesisProviderAudioUnitWrapper") +@interface AVSpeechSynthesisProviderAudioUnitWrapper : NSObject +- (void)cancelSpeechRequest; +- (void)synthesizeSpeechRequest:(AVSpeechSynthesisProviderRequestWrapper * _Nonnull)speechRequest; +- (nonnull instancetype)init SWIFT_UNAVAILABLE; ++ (nonnull instancetype)new SWIFT_UNAVAILABLE_MSG("-init is unavailable"); +@end + +@class AVSpeechSynthesisProviderVoiceWrapper; + +SWIFT_CLASS("_TtC15AVFAudioWrapper39AVSpeechSynthesisProviderRequestWrapper") +@interface AVSpeechSynthesisProviderRequestWrapper : NSObject +@property (nonatomic, readonly, copy) NSString * _Nonnull ssmlRepresentation; +@property (nonatomic, readonly, strong) AVSpeechSynthesisProviderVoiceWrapper * _Nonnull voice; +- (nonnull instancetype)initWithSsmlRepresentation:(NSString * _Nonnull)text voice:(AVSpeechSynthesisProviderVoiceWrapper * _Nonnull)voice OBJC_DESIGNATED_INITIALIZER; +- (nonnull instancetype)init SWIFT_UNAVAILABLE; ++ (nonnull instancetype)new SWIFT_UNAVAILABLE_MSG("-init is unavailable"); +@end + + +SWIFT_CLASS("_TtC15AVFAudioWrapper37AVSpeechSynthesisProviderVoiceWrapper") +@interface AVSpeechSynthesisProviderVoiceWrapper : NSObject +@property (nonatomic) NSInteger age; +@property (nonatomic, readonly, copy) NSString * _Nonnull identifier; +@property (nonatomic, readonly, copy) NSString * _Nonnull name; +@property (nonatomic, copy) NSString * _Nonnull version; ++ (void)updateSpeechVoices; +- (nonnull instancetype)init SWIFT_UNAVAILABLE; ++ (nonnull instancetype)new SWIFT_UNAVAILABLE_MSG("-init is unavailable"); +@end + +@class TraitsWrapper; + +SWIFT_CLASS("_TtC15AVFAudioWrapper29AVSpeechSynthesisVoiceWrapper") +@interface AVSpeechSynthesisVoiceWrapper : NSObject +@property (nonatomic, readonly, copy) NSString * _Nonnull identifier; +@property (nonatomic, readonly, copy) NSString * _Nonnull language; +@property (nonatomic, readonly, copy) NSString * _Nonnull name; +@property (nonatomic, readonly, strong) TraitsWrapper * _Nonnull voiceTraits; +- (nullable instancetype)initWithIdentifier:(NSString * _Nonnull)identifier OBJC_DESIGNATED_INITIALIZER; +- (nullable instancetype)initWithLanguage:(NSString * _Nullable)languageCode OBJC_DESIGNATED_INITIALIZER; ++ (NSString * _Nonnull)currentLanguageCode SWIFT_WARN_UNUSED_RESULT; +- (nonnull instancetype)init SWIFT_UNAVAILABLE; ++ (nonnull instancetype)new SWIFT_UNAVAILABLE_MSG("-init is unavailable"); +@end + + +SWIFT_CLASS("_TtCC15AVFAudioWrapper29AVSpeechSynthesisVoiceWrapper13TraitsWrapper") +@interface TraitsWrapper : NSObject +SWIFT_CLASS_PROPERTY(@property (nonatomic, class, readonly, strong) TraitsWrapper * _Nonnull isNoveltyVoice;) ++ (TraitsWrapper * _Nonnull)isNoveltyVoice SWIFT_WARN_UNUSED_RESULT; +SWIFT_CLASS_PROPERTY(@property (nonatomic, class, readonly, strong) TraitsWrapper * _Nonnull isPersonalVoice;) ++ (TraitsWrapper * _Nonnull)isPersonalVoice SWIFT_WARN_UNUSED_RESULT; +@property (nonatomic, readonly) BOOL isEmpty; +- (nonnull instancetype)init OBJC_DESIGNATED_INITIALIZER; +@end + +@class AVSpeechUtteranceWrapper; + +SWIFT_CLASS("_TtC15AVFAudioWrapper26AVSpeechSynthesizerWrapper") +@interface AVSpeechSynthesizerWrapper : NSObject +@property (nonatomic, readonly) BOOL isPaused; +@property (nonatomic, readonly) BOOL isSpeaking; +- (BOOL)continueSpeaking SWIFT_WARN_UNUSED_RESULT; +- (void)speak:(AVSpeechUtteranceWrapper * _Nonnull)utterance; +- (nonnull instancetype)init SWIFT_UNAVAILABLE; ++ (nonnull instancetype)new SWIFT_UNAVAILABLE_MSG("-init is unavailable"); +@end + + +SWIFT_CLASS("_TtC15AVFAudioWrapper24AVSpeechUtteranceWrapper") +@interface AVSpeechUtteranceWrapper : NSObject +@property (nonatomic) float pitchMultiplier; +@property (nonatomic) NSTimeInterval postUtteranceDelay; +@property (nonatomic) NSTimeInterval preUtteranceDelay; +@property (nonatomic) BOOL prefersAssistiveTechnologySettings; +@property (nonatomic) float rate; +@property (nonatomic, readonly, copy) NSString * _Nonnull speechString; +@property (nonatomic, strong) AVSpeechSynthesisVoiceWrapper * _Nullable voice; +@property (nonatomic) float volume; +- (nullable instancetype)initWithSsmlRepresentation:(NSString * _Nonnull)string OBJC_DESIGNATED_INITIALIZER; +- (nonnull instancetype)initWithString:(NSString * _Nonnull)string OBJC_DESIGNATED_INITIALIZER; +- (nonnull instancetype)init SWIFT_UNAVAILABLE; ++ (nonnull instancetype)new SWIFT_UNAVAILABLE_MSG("-init is unavailable"); +@end + + +SWIFT_CLASS("_TtC15AVFAudioWrapper14GlobalsWrapper") +@interface GlobalsWrapper : NSObject +SWIFT_CLASS_PROPERTY(@property (nonatomic, class, readonly, copy) NSString * _Nonnull AVAudioBitRateStrategy_ConstantWrapper;) ++ (NSString * _Nonnull)AVAudioBitRateStrategy_ConstantWrapper SWIFT_WARN_UNUSED_RESULT; +SWIFT_CLASS_PROPERTY(@property (nonatomic, class, readonly, copy) NSString * _Nonnull AVAudioBitRateStrategy_LongTermAverageWrapper;) ++ (NSString * _Nonnull)AVAudioBitRateStrategy_LongTermAverageWrapper SWIFT_WARN_UNUSED_RESULT; +SWIFT_CLASS_PROPERTY(@property (nonatomic, class, readonly, copy) NSString * _Nonnull AVAudioBitRateStrategy_VariableWrapper;) ++ (NSString * _Nonnull)AVAudioBitRateStrategy_VariableWrapper SWIFT_WARN_UNUSED_RESULT; +SWIFT_CLASS_PROPERTY(@property (nonatomic, class, readonly, copy) NSString * _Nonnull AVAudioBitRateStrategy_VariableConstrainedWrapper;) ++ (NSString * _Nonnull)AVAudioBitRateStrategy_VariableConstrainedWrapper SWIFT_WARN_UNUSED_RESULT; +SWIFT_CLASS_PROPERTY(@property (nonatomic, class, readonly, copy) NSString * _Nonnull AVAudioFileTypeKeyWrapper;) ++ (NSString * _Nonnull)AVAudioFileTypeKeyWrapper SWIFT_WARN_UNUSED_RESULT; +SWIFT_CLASS_PROPERTY(@property (nonatomic, class, readonly, copy) NSString * _Nonnull AVAudioSessionInterruptionWasSuspendedKeyWrapper;) ++ (NSString * _Nonnull)AVAudioSessionInterruptionWasSuspendedKeyWrapper SWIFT_WARN_UNUSED_RESULT; +SWIFT_CLASS_PROPERTY(@property (nonatomic, class, readonly, copy) NSString * _Nonnull AVAudioUnitManufacturerNameAppleWrapper;) ++ (NSString * _Nonnull)AVAudioUnitManufacturerNameAppleWrapper SWIFT_WARN_UNUSED_RESULT; +SWIFT_CLASS_PROPERTY(@property (nonatomic, class, readonly, copy) NSString * _Nonnull AVAudioUnitTypeEffectWrapper;) ++ (NSString * _Nonnull)AVAudioUnitTypeEffectWrapper SWIFT_WARN_UNUSED_RESULT; +SWIFT_CLASS_PROPERTY(@property (nonatomic, class, readonly, copy) NSString * _Nonnull AVAudioUnitTypeFormatConverterWrapper;) ++ (NSString * _Nonnull)AVAudioUnitTypeFormatConverterWrapper SWIFT_WARN_UNUSED_RESULT; +SWIFT_CLASS_PROPERTY(@property (nonatomic, class, readonly, copy) NSString * _Nonnull AVAudioUnitTypeGeneratorWrapper;) ++ (NSString * _Nonnull)AVAudioUnitTypeGeneratorWrapper SWIFT_WARN_UNUSED_RESULT; +SWIFT_CLASS_PROPERTY(@property (nonatomic, class, readonly, copy) NSString * _Nonnull AVAudioUnitTypeMIDIProcessorWrapper;) ++ (NSString * _Nonnull)AVAudioUnitTypeMIDIProcessorWrapper SWIFT_WARN_UNUSED_RESULT; +SWIFT_CLASS_PROPERTY(@property (nonatomic, class, readonly, copy) NSString * _Nonnull AVAudioUnitTypeMixerWrapper;) ++ (NSString * _Nonnull)AVAudioUnitTypeMixerWrapper SWIFT_WARN_UNUSED_RESULT; +SWIFT_CLASS_PROPERTY(@property (nonatomic, class, readonly, copy) NSString * _Nonnull AVAudioUnitTypeMusicDeviceWrapper;) ++ (NSString * _Nonnull)AVAudioUnitTypeMusicDeviceWrapper SWIFT_WARN_UNUSED_RESULT; +SWIFT_CLASS_PROPERTY(@property (nonatomic, class, readonly, copy) NSString * _Nonnull AVAudioUnitTypeMusicEffectWrapper;) ++ (NSString * _Nonnull)AVAudioUnitTypeMusicEffectWrapper SWIFT_WARN_UNUSED_RESULT; +SWIFT_CLASS_PROPERTY(@property (nonatomic, class, readonly, copy) NSString * _Nonnull AVAudioUnitTypeOfflineEffectWrapper;) ++ (NSString * _Nonnull)AVAudioUnitTypeOfflineEffectWrapper SWIFT_WARN_UNUSED_RESULT; +SWIFT_CLASS_PROPERTY(@property (nonatomic, class, readonly, copy) NSString * _Nonnull AVAudioUnitTypeOutputWrapper;) ++ (NSString * _Nonnull)AVAudioUnitTypeOutputWrapper SWIFT_WARN_UNUSED_RESULT; +SWIFT_CLASS_PROPERTY(@property (nonatomic, class, readonly, copy) NSString * _Nonnull AVAudioUnitTypePannerWrapper;) ++ (NSString * _Nonnull)AVAudioUnitTypePannerWrapper SWIFT_WARN_UNUSED_RESULT; +SWIFT_CLASS_PROPERTY(@property (nonatomic, class, readonly, copy) NSString * _Nonnull AVChannelLayoutKeyWrapper;) ++ (NSString * _Nonnull)AVChannelLayoutKeyWrapper SWIFT_WARN_UNUSED_RESULT; +SWIFT_CLASS_PROPERTY(@property (nonatomic, class, readonly, copy) NSString * _Nonnull AVEncoderAudioQualityForVBRKeyWrapper;) ++ (NSString * _Nonnull)AVEncoderAudioQualityForVBRKeyWrapper SWIFT_WARN_UNUSED_RESULT; +SWIFT_CLASS_PROPERTY(@property (nonatomic, class, readonly, copy) NSString * _Nonnull AVEncoderAudioQualityKeyWrapper;) ++ (NSString * _Nonnull)AVEncoderAudioQualityKeyWrapper SWIFT_WARN_UNUSED_RESULT; +SWIFT_CLASS_PROPERTY(@property (nonatomic, class, readonly, copy) NSString * _Nonnull AVEncoderBitDepthHintKeyWrapper;) ++ (NSString * _Nonnull)AVEncoderBitDepthHintKeyWrapper SWIFT_WARN_UNUSED_RESULT; +SWIFT_CLASS_PROPERTY(@property (nonatomic, class, readonly, copy) NSString * _Nonnull AVEncoderBitRateKeyWrapper;) ++ (NSString * _Nonnull)AVEncoderBitRateKeyWrapper SWIFT_WARN_UNUSED_RESULT; +SWIFT_CLASS_PROPERTY(@property (nonatomic, class, readonly, copy) NSString * _Nonnull AVEncoderBitRatePerChannelKeyWrapper;) ++ (NSString * _Nonnull)AVEncoderBitRatePerChannelKeyWrapper SWIFT_WARN_UNUSED_RESULT; +SWIFT_CLASS_PROPERTY(@property (nonatomic, class, readonly, copy) NSString * _Nonnull AVEncoderBitRateStrategyKeyWrapper;) ++ (NSString * _Nonnull)AVEncoderBitRateStrategyKeyWrapper SWIFT_WARN_UNUSED_RESULT; +SWIFT_CLASS_PROPERTY(@property (nonatomic, class, readonly, copy) NSString * _Nonnull AVFormatIDKeyWrapper;) ++ (NSString * _Nonnull)AVFormatIDKeyWrapper SWIFT_WARN_UNUSED_RESULT; +SWIFT_CLASS_PROPERTY(@property (nonatomic, class, readonly, copy) NSString * _Nonnull AVLinearPCMBitDepthKeyWrapper;) ++ (NSString * _Nonnull)AVLinearPCMBitDepthKeyWrapper SWIFT_WARN_UNUSED_RESULT; +SWIFT_CLASS_PROPERTY(@property (nonatomic, class, readonly, copy) NSString * _Nonnull AVLinearPCMIsBigEndianKeyWrapper;) ++ (NSString * _Nonnull)AVLinearPCMIsBigEndianKeyWrapper SWIFT_WARN_UNUSED_RESULT; +SWIFT_CLASS_PROPERTY(@property (nonatomic, class, readonly, copy) NSString * _Nonnull AVLinearPCMIsFloatKeyWrapper;) ++ (NSString * _Nonnull)AVLinearPCMIsFloatKeyWrapper SWIFT_WARN_UNUSED_RESULT; +SWIFT_CLASS_PROPERTY(@property (nonatomic, class, readonly, copy) NSString * _Nonnull AVLinearPCMIsNonInterleavedWrapper;) ++ (NSString * _Nonnull)AVLinearPCMIsNonInterleavedWrapper SWIFT_WARN_UNUSED_RESULT; +SWIFT_CLASS_PROPERTY(@property (nonatomic, class, readonly, copy) NSString * _Nonnull AVNumberOfChannelsKeyWrapper;) ++ (NSString * _Nonnull)AVNumberOfChannelsKeyWrapper SWIFT_WARN_UNUSED_RESULT; +SWIFT_CLASS_PROPERTY(@property (nonatomic, class, readonly, copy) NSString * _Nonnull AVSampleRateConverterAlgorithmKeyWrapper;) ++ (NSString * _Nonnull)AVSampleRateConverterAlgorithmKeyWrapper SWIFT_WARN_UNUSED_RESULT; +SWIFT_CLASS_PROPERTY(@property (nonatomic, class, readonly, copy) NSString * _Nonnull AVSampleRateConverterAlgorithm_MasteringWrapper;) ++ (NSString * _Nonnull)AVSampleRateConverterAlgorithm_MasteringWrapper SWIFT_WARN_UNUSED_RESULT; +SWIFT_CLASS_PROPERTY(@property (nonatomic, class, readonly, copy) NSString * _Nonnull AVSampleRateConverterAlgorithm_MinimumPhaseWrapper;) ++ (NSString * _Nonnull)AVSampleRateConverterAlgorithm_MinimumPhaseWrapper SWIFT_WARN_UNUSED_RESULT; +SWIFT_CLASS_PROPERTY(@property (nonatomic, class, readonly, copy) NSString * _Nonnull AVSampleRateConverterAlgorithm_NormalWrapper;) ++ (NSString * _Nonnull)AVSampleRateConverterAlgorithm_NormalWrapper SWIFT_WARN_UNUSED_RESULT; +SWIFT_CLASS_PROPERTY(@property (nonatomic, class, readonly, copy) NSString * _Nonnull AVSampleRateConverterAudioQualityKeyWrapper;) ++ (NSString * _Nonnull)AVSampleRateConverterAudioQualityKeyWrapper SWIFT_WARN_UNUSED_RESULT; +SWIFT_CLASS_PROPERTY(@property (nonatomic, class, readonly, copy) NSString * _Nonnull AVSampleRateKeyWrapper;) ++ (NSString * _Nonnull)AVSampleRateKeyWrapper SWIFT_WARN_UNUSED_RESULT; +SWIFT_CLASS_PROPERTY(@property (nonatomic, class, readonly, copy) NSString * _Nonnull AVSpeechSynthesisIPANotationAttributeWrapper;) ++ (NSString * _Nonnull)AVSpeechSynthesisIPANotationAttributeWrapper SWIFT_WARN_UNUSED_RESULT; +SWIFT_CLASS_PROPERTY(@property (nonatomic, class, readonly, copy) NSString * _Nonnull AVSpeechSynthesisVoiceIdentifierAlexWrapper;) ++ (NSString * _Nonnull)AVSpeechSynthesisVoiceIdentifierAlexWrapper SWIFT_WARN_UNUSED_RESULT; +SWIFT_CLASS_PROPERTY(@property (nonatomic, class, readonly) float AVSpeechUtteranceDefaultSpeechRateWrapper;) ++ (float)AVSpeechUtteranceDefaultSpeechRateWrapper SWIFT_WARN_UNUSED_RESULT; +SWIFT_CLASS_PROPERTY(@property (nonatomic, class, readonly) float AVSpeechUtteranceMaximumSpeechRateWrapper;) ++ (float)AVSpeechUtteranceMaximumSpeechRateWrapper SWIFT_WARN_UNUSED_RESULT; +SWIFT_CLASS_PROPERTY(@property (nonatomic, class, readonly) float AVSpeechUtteranceMinimumSpeechRateWrapper;) ++ (float)AVSpeechUtteranceMinimumSpeechRateWrapper SWIFT_WARN_UNUSED_RESULT; +SWIFT_CLASS_PROPERTY(@property (nonatomic, class, readonly) double AVMusicTimeStampEndOfTrackWrapper;) ++ (double)AVMusicTimeStampEndOfTrackWrapper SWIFT_WARN_UNUSED_RESULT; ++ (AVAudio3DAngularOrientationWrapper * _Nonnull)AVAudioMake3DAngularOrientationWrapper:(float)yaw :(float)pitch :(float)roll SWIFT_WARN_UNUSED_RESULT; ++ (AVAudio3DPointWrapper * _Nonnull)AVAudioMake3DPointWrapper:(float)x :(float)y :(float)z SWIFT_WARN_UNUSED_RESULT; +- (nonnull instancetype)init OBJC_DESIGNATED_INITIALIZER; +@end + +#endif +#if __has_attribute(external_source_symbol) +# pragma clang attribute pop +#endif +#if defined(__cplusplus) +#endif +#pragma clang diagnostic pop +#endif diff --git a/pkgs/swiftgen/test/integration/temp/classes.h b/pkgs/swiftgen/test/integration/temp/classes.h new file mode 100644 index 000000000..0276179bd --- /dev/null +++ b/pkgs/swiftgen/test/integration/temp/classes.h @@ -0,0 +1,326 @@ +// Generated by Apple Swift version 6.0.3 effective-5.10 (swiftlang-6.0.3.1.10 clang-1600.0.30.1) +#ifndef CLASSES_SWIFT_H +#define CLASSES_SWIFT_H +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wgcc-compat" + +#if !defined(__has_include) +# define __has_include(x) 0 +#endif +#if !defined(__has_attribute) +# define __has_attribute(x) 0 +#endif +#if !defined(__has_feature) +# define __has_feature(x) 0 +#endif +#if !defined(__has_warning) +# define __has_warning(x) 0 +#endif + +#if __has_include() +# include +#endif + +#pragma clang diagnostic ignored "-Wauto-import" +#if defined(__OBJC__) +#include +#endif +#if defined(__cplusplus) +#include +#include +#include +#include +#include +#include +#include +#else +#include +#include +#include +#include +#endif +#if defined(__cplusplus) +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wnon-modular-include-in-framework-module" +#if defined(__arm64e__) && __has_include() +# include +#else +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wreserved-macro-identifier" +# ifndef __ptrauth_swift_value_witness_function_pointer +# define __ptrauth_swift_value_witness_function_pointer(x) +# endif +# ifndef __ptrauth_swift_class_method_pointer +# define __ptrauth_swift_class_method_pointer(x) +# endif +#pragma clang diagnostic pop +#endif +#pragma clang diagnostic pop +#endif + +#if !defined(SWIFT_TYPEDEFS) +# define SWIFT_TYPEDEFS 1 +# if __has_include() +# include +# elif !defined(__cplusplus) +typedef uint_least16_t char16_t; +typedef uint_least32_t char32_t; +# endif +typedef float swift_float2 __attribute__((__ext_vector_type__(2))); +typedef float swift_float3 __attribute__((__ext_vector_type__(3))); +typedef float swift_float4 __attribute__((__ext_vector_type__(4))); +typedef double swift_double2 __attribute__((__ext_vector_type__(2))); +typedef double swift_double3 __attribute__((__ext_vector_type__(3))); +typedef double swift_double4 __attribute__((__ext_vector_type__(4))); +typedef int swift_int2 __attribute__((__ext_vector_type__(2))); +typedef int swift_int3 __attribute__((__ext_vector_type__(3))); +typedef int swift_int4 __attribute__((__ext_vector_type__(4))); +typedef unsigned int swift_uint2 __attribute__((__ext_vector_type__(2))); +typedef unsigned int swift_uint3 __attribute__((__ext_vector_type__(3))); +typedef unsigned int swift_uint4 __attribute__((__ext_vector_type__(4))); +#endif + +#if !defined(SWIFT_PASTE) +# define SWIFT_PASTE_HELPER(x, y) x##y +# define SWIFT_PASTE(x, y) SWIFT_PASTE_HELPER(x, y) +#endif +#if !defined(SWIFT_METATYPE) +# define SWIFT_METATYPE(X) Class +#endif +#if !defined(SWIFT_CLASS_PROPERTY) +# if __has_feature(objc_class_property) +# define SWIFT_CLASS_PROPERTY(...) __VA_ARGS__ +# else +# define SWIFT_CLASS_PROPERTY(...) +# endif +#endif +#if !defined(SWIFT_RUNTIME_NAME) +# if __has_attribute(objc_runtime_name) +# define SWIFT_RUNTIME_NAME(X) __attribute__((objc_runtime_name(X))) +# else +# define SWIFT_RUNTIME_NAME(X) +# endif +#endif +#if !defined(SWIFT_COMPILE_NAME) +# if __has_attribute(swift_name) +# define SWIFT_COMPILE_NAME(X) __attribute__((swift_name(X))) +# else +# define SWIFT_COMPILE_NAME(X) +# endif +#endif +#if !defined(SWIFT_METHOD_FAMILY) +# if __has_attribute(objc_method_family) +# define SWIFT_METHOD_FAMILY(X) __attribute__((objc_method_family(X))) +# else +# define SWIFT_METHOD_FAMILY(X) +# endif +#endif +#if !defined(SWIFT_NOESCAPE) +# if __has_attribute(noescape) +# define SWIFT_NOESCAPE __attribute__((noescape)) +# else +# define SWIFT_NOESCAPE +# endif +#endif +#if !defined(SWIFT_RELEASES_ARGUMENT) +# if __has_attribute(ns_consumed) +# define SWIFT_RELEASES_ARGUMENT __attribute__((ns_consumed)) +# else +# define SWIFT_RELEASES_ARGUMENT +# endif +#endif +#if !defined(SWIFT_WARN_UNUSED_RESULT) +# if __has_attribute(warn_unused_result) +# define SWIFT_WARN_UNUSED_RESULT __attribute__((warn_unused_result)) +# else +# define SWIFT_WARN_UNUSED_RESULT +# endif +#endif +#if !defined(SWIFT_NORETURN) +# if __has_attribute(noreturn) +# define SWIFT_NORETURN __attribute__((noreturn)) +# else +# define SWIFT_NORETURN +# endif +#endif +#if !defined(SWIFT_CLASS_EXTRA) +# define SWIFT_CLASS_EXTRA +#endif +#if !defined(SWIFT_PROTOCOL_EXTRA) +# define SWIFT_PROTOCOL_EXTRA +#endif +#if !defined(SWIFT_ENUM_EXTRA) +# define SWIFT_ENUM_EXTRA +#endif +#if !defined(SWIFT_CLASS) +# if __has_attribute(objc_subclassing_restricted) +# define SWIFT_CLASS(SWIFT_NAME) SWIFT_RUNTIME_NAME(SWIFT_NAME) __attribute__((objc_subclassing_restricted)) SWIFT_CLASS_EXTRA +# define SWIFT_CLASS_NAMED(SWIFT_NAME) __attribute__((objc_subclassing_restricted)) SWIFT_COMPILE_NAME(SWIFT_NAME) SWIFT_CLASS_EXTRA +# else +# define SWIFT_CLASS(SWIFT_NAME) SWIFT_RUNTIME_NAME(SWIFT_NAME) SWIFT_CLASS_EXTRA +# define SWIFT_CLASS_NAMED(SWIFT_NAME) SWIFT_COMPILE_NAME(SWIFT_NAME) SWIFT_CLASS_EXTRA +# endif +#endif +#if !defined(SWIFT_RESILIENT_CLASS) +# if __has_attribute(objc_class_stub) +# define SWIFT_RESILIENT_CLASS(SWIFT_NAME) SWIFT_CLASS(SWIFT_NAME) __attribute__((objc_class_stub)) +# define SWIFT_RESILIENT_CLASS_NAMED(SWIFT_NAME) __attribute__((objc_class_stub)) SWIFT_CLASS_NAMED(SWIFT_NAME) +# else +# define SWIFT_RESILIENT_CLASS(SWIFT_NAME) SWIFT_CLASS(SWIFT_NAME) +# define SWIFT_RESILIENT_CLASS_NAMED(SWIFT_NAME) SWIFT_CLASS_NAMED(SWIFT_NAME) +# endif +#endif +#if !defined(SWIFT_PROTOCOL) +# define SWIFT_PROTOCOL(SWIFT_NAME) SWIFT_RUNTIME_NAME(SWIFT_NAME) SWIFT_PROTOCOL_EXTRA +# define SWIFT_PROTOCOL_NAMED(SWIFT_NAME) SWIFT_COMPILE_NAME(SWIFT_NAME) SWIFT_PROTOCOL_EXTRA +#endif +#if !defined(SWIFT_EXTENSION) +# define SWIFT_EXTENSION(M) SWIFT_PASTE(M##_Swift_, __LINE__) +#endif +#if !defined(OBJC_DESIGNATED_INITIALIZER) +# if __has_attribute(objc_designated_initializer) +# define OBJC_DESIGNATED_INITIALIZER __attribute__((objc_designated_initializer)) +# else +# define OBJC_DESIGNATED_INITIALIZER +# endif +#endif +#if !defined(SWIFT_ENUM_ATTR) +# if __has_attribute(enum_extensibility) +# define SWIFT_ENUM_ATTR(_extensibility) __attribute__((enum_extensibility(_extensibility))) +# else +# define SWIFT_ENUM_ATTR(_extensibility) +# endif +#endif +#if !defined(SWIFT_ENUM) +# define SWIFT_ENUM(_type, _name, _extensibility) enum _name : _type _name; enum SWIFT_ENUM_ATTR(_extensibility) SWIFT_ENUM_EXTRA _name : _type +# if __has_feature(generalized_swift_name) +# define SWIFT_ENUM_NAMED(_type, _name, SWIFT_NAME, _extensibility) enum _name : _type _name SWIFT_COMPILE_NAME(SWIFT_NAME); enum SWIFT_COMPILE_NAME(SWIFT_NAME) SWIFT_ENUM_ATTR(_extensibility) SWIFT_ENUM_EXTRA _name : _type +# else +# define SWIFT_ENUM_NAMED(_type, _name, SWIFT_NAME, _extensibility) SWIFT_ENUM(_type, _name, _extensibility) +# endif +#endif +#if !defined(SWIFT_UNAVAILABLE) +# define SWIFT_UNAVAILABLE __attribute__((unavailable)) +#endif +#if !defined(SWIFT_UNAVAILABLE_MSG) +# define SWIFT_UNAVAILABLE_MSG(msg) __attribute__((unavailable(msg))) +#endif +#if !defined(SWIFT_AVAILABILITY) +# define SWIFT_AVAILABILITY(plat, ...) __attribute__((availability(plat, __VA_ARGS__))) +#endif +#if !defined(SWIFT_WEAK_IMPORT) +# define SWIFT_WEAK_IMPORT __attribute__((weak_import)) +#endif +#if !defined(SWIFT_DEPRECATED) +# define SWIFT_DEPRECATED __attribute__((deprecated)) +#endif +#if !defined(SWIFT_DEPRECATED_MSG) +# define SWIFT_DEPRECATED_MSG(...) __attribute__((deprecated(__VA_ARGS__))) +#endif +#if !defined(SWIFT_DEPRECATED_OBJC) +# if __has_feature(attribute_diagnose_if_objc) +# define SWIFT_DEPRECATED_OBJC(Msg) __attribute__((diagnose_if(1, Msg, "warning"))) +# else +# define SWIFT_DEPRECATED_OBJC(Msg) SWIFT_DEPRECATED_MSG(Msg) +# endif +#endif +#if defined(__OBJC__) +#if !defined(IBSegueAction) +# define IBSegueAction +#endif +#endif +#if !defined(SWIFT_EXTERN) +# if defined(__cplusplus) +# define SWIFT_EXTERN extern "C" +# else +# define SWIFT_EXTERN extern +# endif +#endif +#if !defined(SWIFT_CALL) +# define SWIFT_CALL __attribute__((swiftcall)) +#endif +#if !defined(SWIFT_INDIRECT_RESULT) +# define SWIFT_INDIRECT_RESULT __attribute__((swift_indirect_result)) +#endif +#if !defined(SWIFT_CONTEXT) +# define SWIFT_CONTEXT __attribute__((swift_context)) +#endif +#if !defined(SWIFT_ERROR_RESULT) +# define SWIFT_ERROR_RESULT __attribute__((swift_error_result)) +#endif +#if defined(__cplusplus) +# define SWIFT_NOEXCEPT noexcept +#else +# define SWIFT_NOEXCEPT +#endif +#if !defined(SWIFT_C_INLINE_THUNK) +# if __has_attribute(always_inline) +# if __has_attribute(nodebug) +# define SWIFT_C_INLINE_THUNK inline __attribute__((always_inline)) __attribute__((nodebug)) +# else +# define SWIFT_C_INLINE_THUNK inline __attribute__((always_inline)) +# endif +# else +# define SWIFT_C_INLINE_THUNK inline +# endif +#endif +#if defined(_WIN32) +#if !defined(SWIFT_IMPORT_STDLIB_SYMBOL) +# define SWIFT_IMPORT_STDLIB_SYMBOL __declspec(dllimport) +#endif +#else +#if !defined(SWIFT_IMPORT_STDLIB_SYMBOL) +# define SWIFT_IMPORT_STDLIB_SYMBOL +#endif +#endif +#if defined(__OBJC__) +#if __has_feature(objc_modules) +#if __has_warning("-Watimport-in-framework-header") +#pragma clang diagnostic ignored "-Watimport-in-framework-header" +#endif +@import ObjectiveC; +#endif + +#endif +#pragma clang diagnostic ignored "-Wproperty-attribute-mismatch" +#pragma clang diagnostic ignored "-Wduplicate-method-arg" +#if __has_warning("-Wpragma-clang-attribute") +# pragma clang diagnostic ignored "-Wpragma-clang-attribute" +#endif +#pragma clang diagnostic ignored "-Wunknown-pragmas" +#pragma clang diagnostic ignored "-Wnullability" +#pragma clang diagnostic ignored "-Wdollar-in-identifier-extension" +#pragma clang diagnostic ignored "-Wunsafe-buffer-usage" + +#if __has_attribute(external_source_symbol) +# pragma push_macro("any") +# undef any +# pragma clang attribute push(__attribute__((external_source_symbol(language="Swift", defined_in="classes",generated_declaration))), apply_to=any(function,enum,objc_interface,objc_category,objc_protocol)) +# pragma pop_macro("any") +#endif + +#if defined(__OBJC__) +@class TestOtherClass; + +SWIFT_CLASS("_TtC7classes9TestClass") +@interface TestClass : NSObject +- (TestOtherClass * _Nonnull)myMethod SWIFT_WARN_UNUSED_RESULT; ++ (TestClass * _Nonnull)create SWIFT_WARN_UNUSED_RESULT; +- (nonnull instancetype)init OBJC_DESIGNATED_INITIALIZER; +@end + + +SWIFT_CLASS("_TtC7classes14TestOtherClass") +@interface TestOtherClass : NSObject +- (NSInteger)times10WithX:(NSInteger)x SWIFT_WARN_UNUSED_RESULT; +- (nonnull instancetype)init OBJC_DESIGNATED_INITIALIZER; +@end + +#endif +#if __has_attribute(external_source_symbol) +# pragma clang attribute pop +#endif +#if defined(__cplusplus) +#endif +#pragma clang diagnostic pop +#endif diff --git a/pkgs/swiftgen/test/integration/temp/classes_output.dart b/pkgs/swiftgen/test/integration/temp/classes_output.dart new file mode 100644 index 000000000..ab70b9acc --- /dev/null +++ b/pkgs/swiftgen/test/integration/temp/classes_output.dart @@ -0,0 +1,434 @@ +// Copyright (c) 2025, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +// ignore_for_file: always_specify_types +// ignore_for_file: camel_case_types +// ignore_for_file: non_constant_identifier_names +// ignore_for_file: unnecessary_non_null_assertion +// ignore_for_file: unused_element +// ignore_for_file: unused_field +// coverage:ignore-file + +// AUTO GENERATED FILE, DO NOT EDIT. +// +// Generated by `package:ffigen`. +// ignore_for_file: type=lint +import 'dart:ffi' as ffi; +import 'package:objective_c/objective_c.dart' as objc; + +@ffi.Native< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ) +>() +external ffi.Pointer _classes_protocolTrampoline_1mbt9g9( + ffi.Pointer target, + ffi.Pointer arg0, +); + +late final _class_TestClass = objc.getClass("classes.TestClass"); +late final _sel_isKindOfClass_ = objc.registerName("isKindOfClass:"); +final _objc_msgSend_19nvye5 = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Bool Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ) + > + >() + .asFunction< + bool Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ) + >(); +late final _class_TestOtherClass = objc.getClass("classes.TestOtherClass"); +late final _sel_times10WithX_ = objc.registerName("times10WithX:"); +final _objc_msgSend_12hwf9n = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Long Function( + ffi.Pointer, + ffi.Pointer, + ffi.Long, + ) + > + >() + .asFunction< + int Function( + ffi.Pointer, + ffi.Pointer, + int, + ) + >(); +typedef instancetype = ffi.Pointer; +typedef Dartinstancetype = objc.ObjCObjectBase; +late final _sel_init = objc.registerName("init"); +final _objc_msgSend_151sglz = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ) + > + >() + .asFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ) + >(); +late final _sel_new = objc.registerName("new"); +late final _sel_allocWithZone_ = objc.registerName("allocWithZone:"); +final _objc_msgSend_1cwp428 = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ) + > + >() + .asFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ) + >(); +late final _sel_alloc = objc.registerName("alloc"); +late final _sel_self = objc.registerName("self"); +ffi.Pointer _ObjCBlock_objcObjCObject_ffiVoid_fnPtrTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, +) => block.ref.target + .cast< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer arg0) + > + >() + .asFunction< + ffi.Pointer Function(ffi.Pointer) + >()(arg0); +ffi.Pointer _ObjCBlock_objcObjCObject_ffiVoid_fnPtrCallable = + ffi.Pointer.fromFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ) + >(_ObjCBlock_objcObjCObject_ffiVoid_fnPtrTrampoline) + .cast(); +ffi.Pointer +_ObjCBlock_objcObjCObject_ffiVoid_closureTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, +) => + (objc.getBlockClosure(block) + as ffi.Pointer Function(ffi.Pointer))(arg0); +ffi.Pointer _ObjCBlock_objcObjCObject_ffiVoid_closureCallable = + ffi.Pointer.fromFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ) + >(_ObjCBlock_objcObjCObject_ffiVoid_closureTrampoline) + .cast(); + +/// Construction methods for `objc.ObjCBlock Function(ffi.Pointer)>`. +abstract final class ObjCBlock_objcObjCObject_ffiVoid { + /// Returns a block that wraps the given raw block pointer. + static objc.ObjCBlock< + ffi.Pointer Function(ffi.Pointer) + > + castFromPointer( + ffi.Pointer pointer, { + bool retain = false, + bool release = false, + }) => + objc.ObjCBlock< + ffi.Pointer Function(ffi.Pointer) + >(pointer, retain: retain, release: release); + + /// Creates a block from a C function pointer. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock< + ffi.Pointer Function(ffi.Pointer) + > + fromFunctionPointer( + ffi.Pointer< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer arg0) + > + > + ptr, + ) => + objc.ObjCBlock< + ffi.Pointer Function(ffi.Pointer) + >( + objc.newPointerBlock( + _ObjCBlock_objcObjCObject_ffiVoid_fnPtrCallable, + ptr.cast(), + ), + retain: false, + release: true, + ); + + /// Creates a block from a Dart function. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + /// + /// If `keepIsolateAlive` is true, this block will keep this isolate alive + /// until it is garbage collected by both Dart and ObjC. + static objc.ObjCBlock< + ffi.Pointer Function(ffi.Pointer) + > + fromFunction( + objc.ObjCObjectBase Function(ffi.Pointer) fn, { + bool keepIsolateAlive = true, + }) => + objc.ObjCBlock< + ffi.Pointer Function(ffi.Pointer) + >( + objc.newClosureBlock( + _ObjCBlock_objcObjCObject_ffiVoid_closureCallable, + (ffi.Pointer arg0) => fn(arg0).ref.retainAndAutorelease(), + keepIsolateAlive, + ), + retain: false, + release: true, + ); +} + +/// Call operator for `objc.ObjCBlock Function(ffi.Pointer)>`. +extension ObjCBlock_objcObjCObject_ffiVoid_CallExtension + on + objc.ObjCBlock< + ffi.Pointer Function(ffi.Pointer) + > { + objc.ObjCObjectBase call(ffi.Pointer arg0) => objc.ObjCObjectBase( + ref.pointer.ref.invoke + .cast< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer block, + ffi.Pointer arg0, + ) + > + >() + .asFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ) + >()(ref.pointer, arg0), + retain: true, + release: true, + ); +} + +late final _sel_retain = objc.registerName("retain"); +late final _sel_autorelease = objc.registerName("autorelease"); + +/// TestOtherClass +class TestOtherClass extends objc.NSObject { + TestOtherClass._( + ffi.Pointer pointer, { + bool retain = false, + bool release = false, + }) : super.castFromPointer(pointer, retain: retain, release: release); + + /// Constructs a [TestOtherClass] that points to the same underlying object as [other]. + TestOtherClass.castFrom(objc.ObjCObjectBase other) + : this._(other.ref.pointer, retain: true, release: true); + + /// Constructs a [TestOtherClass] that wraps the given raw object pointer. + TestOtherClass.castFromPointer( + ffi.Pointer other, { + bool retain = false, + bool release = false, + }) : this._(other, retain: retain, release: release); + + /// Returns whether [obj] is an instance of [TestOtherClass]. + static bool isInstance(objc.ObjCObjectBase obj) { + return _objc_msgSend_19nvye5( + obj.ref.pointer, + _sel_isKindOfClass_, + _class_TestOtherClass, + ); + } + + /// times10WithX: + int times10WithX(int x) { + return _objc_msgSend_12hwf9n(this.ref.pointer, _sel_times10WithX_, x); + } + + /// init + TestOtherClass init() { + objc.checkOsVersionInternal( + 'TestOtherClass.init', + iOS: (false, (2, 0, 0)), + macOS: (false, (10, 0, 0)), + ); + final _ret = _objc_msgSend_151sglz( + this.ref.retainAndReturnPointer(), + _sel_init, + ); + return TestOtherClass.castFromPointer(_ret, retain: false, release: true); + } + + /// new + static TestOtherClass new$() { + final _ret = _objc_msgSend_151sglz(_class_TestOtherClass, _sel_new); + return TestOtherClass.castFromPointer(_ret, retain: false, release: true); + } + + /// allocWithZone: + static TestOtherClass allocWithZone(ffi.Pointer zone) { + final _ret = _objc_msgSend_1cwp428( + _class_TestOtherClass, + _sel_allocWithZone_, + zone, + ); + return TestOtherClass.castFromPointer(_ret, retain: false, release: true); + } + + /// alloc + static TestOtherClass alloc() { + final _ret = _objc_msgSend_151sglz(_class_TestOtherClass, _sel_alloc); + return TestOtherClass.castFromPointer(_ret, retain: false, release: true); + } + + /// self + TestOtherClass self$1() { + final _ret = _objc_msgSend_151sglz(this.ref.pointer, _sel_self); + return TestOtherClass.castFromPointer(_ret, retain: true, release: true); + } + + /// retain + TestOtherClass retain() { + final _ret = _objc_msgSend_151sglz(this.ref.pointer, _sel_retain); + return TestOtherClass.castFromPointer(_ret, retain: true, release: true); + } + + /// autorelease + TestOtherClass autorelease() { + final _ret = _objc_msgSend_151sglz(this.ref.pointer, _sel_autorelease); + return TestOtherClass.castFromPointer(_ret, retain: true, release: true); + } + + /// Returns a new instance of TestOtherClass constructed with the default `new` method. + factory TestOtherClass() => new$(); +} + +late final _sel_myMethod = objc.registerName("myMethod"); +late final _sel_create = objc.registerName("create"); + +/// TestClass +class TestClass extends objc.NSObject { + TestClass._( + ffi.Pointer pointer, { + bool retain = false, + bool release = false, + }) : super.castFromPointer(pointer, retain: retain, release: release); + + /// Constructs a [TestClass] that points to the same underlying object as [other]. + TestClass.castFrom(objc.ObjCObjectBase other) + : this._(other.ref.pointer, retain: true, release: true); + + /// Constructs a [TestClass] that wraps the given raw object pointer. + TestClass.castFromPointer( + ffi.Pointer other, { + bool retain = false, + bool release = false, + }) : this._(other, retain: retain, release: release); + + /// Returns whether [obj] is an instance of [TestClass]. + static bool isInstance(objc.ObjCObjectBase obj) { + return _objc_msgSend_19nvye5( + obj.ref.pointer, + _sel_isKindOfClass_, + _class_TestClass, + ); + } + + /// myMethod + TestOtherClass myMethod() { + final _ret = _objc_msgSend_151sglz(this.ref.pointer, _sel_myMethod); + return TestOtherClass.castFromPointer(_ret, retain: true, release: true); + } + + /// create + static TestClass create() { + final _ret = _objc_msgSend_151sglz(_class_TestClass, _sel_create); + return TestClass.castFromPointer(_ret, retain: true, release: true); + } + + /// init + TestClass init() { + objc.checkOsVersionInternal( + 'TestClass.init', + iOS: (false, (2, 0, 0)), + macOS: (false, (10, 0, 0)), + ); + final _ret = _objc_msgSend_151sglz( + this.ref.retainAndReturnPointer(), + _sel_init, + ); + return TestClass.castFromPointer(_ret, retain: false, release: true); + } + + /// new + static TestClass new$() { + final _ret = _objc_msgSend_151sglz(_class_TestClass, _sel_new); + return TestClass.castFromPointer(_ret, retain: false, release: true); + } + + /// allocWithZone: + static TestClass allocWithZone(ffi.Pointer zone) { + final _ret = _objc_msgSend_1cwp428( + _class_TestClass, + _sel_allocWithZone_, + zone, + ); + return TestClass.castFromPointer(_ret, retain: false, release: true); + } + + /// alloc + static TestClass alloc() { + final _ret = _objc_msgSend_151sglz(_class_TestClass, _sel_alloc); + return TestClass.castFromPointer(_ret, retain: false, release: true); + } + + /// self + TestClass self$1() { + final _ret = _objc_msgSend_151sglz(this.ref.pointer, _sel_self); + return TestClass.castFromPointer(_ret, retain: true, release: true); + } + + /// retain + TestClass retain() { + final _ret = _objc_msgSend_151sglz(this.ref.pointer, _sel_retain); + return TestClass.castFromPointer(_ret, retain: true, release: true); + } + + /// autorelease + TestClass autorelease() { + final _ret = _objc_msgSend_151sglz(this.ref.pointer, _sel_autorelease); + return TestClass.castFromPointer(_ret, retain: true, release: true); + } + + /// Returns a new instance of TestClass constructed with the default `new` method. + factory TestClass() => new$(); +} diff --git a/pkgs/swiftgen/test/integration/temp/classes_output.m b/pkgs/swiftgen/test/integration/temp/classes_output.m new file mode 100644 index 000000000..7417ad582 --- /dev/null +++ b/pkgs/swiftgen/test/integration/temp/classes_output.m @@ -0,0 +1,59 @@ +#include +#import +#import +#import "classes.h" + +#if !__has_feature(objc_arc) +#error "This file must be compiled with ARC enabled" +#endif + +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wundeclared-selector" + +typedef struct { + int64_t version; + void* (*newWaiter)(void); + void (*awaitWaiter)(void*); + void* (*currentIsolate)(void); + void (*enterIsolate)(void*); + void (*exitIsolate)(void); + int64_t (*getMainPortId)(void); + bool (*getCurrentThreadOwnsIsolate)(int64_t); +} DOBJC_Context; + +id objc_retainBlock(id); + +#define BLOCKING_BLOCK_IMPL(ctx, BLOCK_SIG, INVOKE_DIRECT, INVOKE_LISTENER) \ + assert(ctx->version >= 1); \ + void* targetIsolate = ctx->currentIsolate(); \ + int64_t targetPort = ctx->getMainPortId == NULL ? 0 : ctx->getMainPortId(); \ + return BLOCK_SIG { \ + void* currentIsolate = ctx->currentIsolate(); \ + bool mayEnterIsolate = \ + currentIsolate == NULL && \ + ctx->getCurrentThreadOwnsIsolate != NULL && \ + ctx->getCurrentThreadOwnsIsolate(targetPort); \ + if (currentIsolate == targetIsolate || mayEnterIsolate) { \ + if (mayEnterIsolate) { \ + ctx->enterIsolate(targetIsolate); \ + } \ + INVOKE_DIRECT; \ + if (mayEnterIsolate) { \ + ctx->exitIsolate(); \ + } \ + } else { \ + void* waiter = ctx->newWaiter(); \ + INVOKE_LISTENER; \ + ctx->awaitWaiter(waiter); \ + } \ + }; + + +typedef id (^ProtocolTrampoline)(void * sel); +__attribute__((visibility("default"))) __attribute__((used)) +id _classes_protocolTrampoline_1mbt9g9(id target, void * sel) { + return ((ProtocolTrampoline)((id (*)(id, SEL, SEL))objc_msgSend)(target, @selector(getDOBJCDartProtocolMethodForSelector:), sel))(sel); +} +#undef BLOCKING_BLOCK_IMPL + +#pragma clang diagnostic pop