dart-interop/cupertino_ffi

SceneKit support

Closed this issue · 2 comments

Hi, great library. Any chance to support SceneKit?

Thanks!

Adding the following to the libraries list in ./tool/generate_objc_bindings.dart seems to build both SceneKit and ModelIO:

  ObjcLibrary(
    productName: "SceneKit",
    uri: "https://developer.apple.com/documentation/scenekit?language=objc",
    generatedPath: "lib/scenekit.dart",
    libraryName: "cupertino_ffi.scenekit",
    libraryPath:
        "/System/Library/Frameworks/SceneKit.framework/Versions/A/SceneKit",
  ),
  ObjcLibrary(
    productName: "ModelIO",
    uri: "https://developer.apple.com/documentation/modelio?language=objc",
    generatedPath: "lib/modelio.dart",
    libraryName: "cupertino_ffi.modelio",
    libraryPath:
        "/System/Library/Frameworks/ModelIO.framework/Versions/A/ModelIO",
  ),

Now a SCNBox can be created:

import 'package:cupertino_ffi/scenekit.dart';

void main() {
  var a = SCNBox.allocate();
  SCNBox.init(a);
  SCNBox.setWidth(a, 1.234);
  print(SCNBox.width(a)); // confirms width of 1.234
}

Is this correct usage for Objective-C objects?

Hi! I would advise against doing any SceneKit stuff in Dart. I added it to the list of supported Objective-C libraries, but cupertino_ffi is still buggy and lacks essential stuff.