-
Couldn't load subscription status.
- Fork 739
Objective-C interop doc updates #6942
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
Visit the preview URL for this PR (updated for commit 93e64c5): |
|
I believe the failure was from a version of Jaspr that had a regression. I updated the branch with main which should pull in the release with a fix.
You're right, Swift isn't supported yet, but if I'm planning to work on basic support for Swift soon, is the no highlighting fallback sufficient until I can finish that? |
Yep, no hilighting is fine for now. |
|
@parlough This is ready for review. PTAL |
|
Sorry about the delay in reviewing this. I'll make sure to take a look before Monday! \cc @antfitch For reviewing the writing and structure. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall these updates look good to me after a few updates, thanks for coming back to them @liamappelbe!
Do wait for @antfitch's approval as well before landing :)
| First, we'll tell FFIgen where to find the API we're trying to | ||
| generate bindings for. | ||
| To do this, we set the `headers.entryPoints` option. | ||
|
|
||
| For this example, we need to load `AVAudioPlayer.h`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally the style guide suggests addressing the reader as you:
| First, we'll tell FFIgen where to find the API we're trying to | |
| generate bindings for. | |
| To do this, we set the `headers.entryPoints` option. | |
| For this example, we need to load `AVAudioPlayer.h`. | |
| First, you'll tell FFIgen where to find the API we're trying to | |
| generate bindings for. | |
| To do this, you set the `headers.entryPoints` option. | |
| For this example, you'll load `AVAudioPlayer.h`. |
| such as `macSdkPath`. | ||
| Using these helper functions makes your code generation script | ||
| more reliable across different machines, | ||
| which may have different SDK installation locations. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| which may have different SDK installation locations. | |
| which might have different SDK installation locations. |
| if the API you're generating bindings for needs it | ||
| (e.g. if you're using blocks or protocols). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| if the API you're generating bindings for needs it | |
| (e.g. if you're using blocks or protocols). | |
| if the API you're generating bindings for needs it, | |
| such as if you're using blocks or protocols. |
| but with `.m` at the end of the file name. | ||
| You can change its location with `output.objectiveCFile` option. | ||
| If FFIgen produces this file, you must compile it into your package, | ||
| otherwise you may get runtime exceptions to do with missing symbols. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| otherwise you may get runtime exceptions to do with missing symbols. | |
| otherwise you might get runtime exceptions relating to missing symbols. |
| ```console | ||
| $ dart run ffigen --config my_ffigen_config.yaml | ||
| ``` | ||
| You may notice other classes in the file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| You may notice other classes in the file | |
| You might notice other classes in the file |
| ``` | ||
| You may notice other classes in the file | ||
| with a comment indicating they are a stub. | ||
| FFIgen will generate stub bindings for all transitive dependencies |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| FFIgen will generate stub bindings for all transitive dependencies | |
| FFIgen generates stub bindings for all transitive dependencies |
| `FooBlock.blocking` may add support for non-`void` return values in future, | ||
| if there is user demand for it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| `FooBlock.blocking` may add support for non-`void` return values in future, | |
| if there is user demand for it. | |
| If there is demand for it, | |
| `FooBlock.blocking` might add support for | |
| non-`void` return values in the future. |
| so this isn't an issue when invoking these thread-locked APIs | ||
| from the main isolate. | ||
| If you need to invoke these APIs from other isolates, | ||
| or you need to support older versions of flutter, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| or you need to support older versions of flutter, | |
| or you need to support older versions of Flutter, |
| There is an experimental project to automate these steps | ||
| called [Swiftgen][]. | ||
|
|
||
| [Swiftgen]: https://pub.dev/packages/swiftgen |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| [Swiftgen]: https://pub.dev/packages/swiftgen | |
| [Swiftgen]: {{site.pub-pkg}}/swiftgen |
Update The Objective-C interop documentation to use the new FFIgen config Dart API, instead of YAML configs. I haven't updated the Swift example, because that will soon be replaced by swiftgen.
Fixes dart-lang/native#2710