-
Notifications
You must be signed in to change notification settings - Fork 133
How are bindings to existing native frameworks generated?
##RoboPods If your looking for a binding to a popular 3rd party library, it maybe already be done by the RoboPod project. For a list of current supported libraries take a look at: https://github.com/MobiDevelop/robovm-robopods/issues/1
##bro-gen bro-gen is a Ruby script that generates RoboVM bindings semi-automatically. You need to write a YAML mapping file for the library to generate the binding. For details head over to CoderBaron's fork of bro-gen which works with the current RoboVM version https://github.com/CoderBaron/robovm-bro-gen
For some examples of YAML mapping files take a look at the config files for the iOS Cocoatouch or UIKit bindings in this repository https://github.com/MobiDevelop/robovm/tree/master/compiler/cocoatouch/src/main/bro-gen Those mappings are automatically generated with CoderBaron's bro-gen fork.
##Create bindings manually For small to medium sized libraries it maybe feasible to write the bindings manually. For a simple example binding take a look at the bindings to the SVGgh library https://github.com/florianf/robopod-ghs-svg.
The original RoboVM documentation has a nice introduction to the binding mechanism used by RoboVm http://docs.robovm.com/advanced-topics/bro.html
##Tips & Tricks
-
CGRect
andCGSize
method parameters should always be annotated with the@ByVal
annotation. - Bro doesn't support
float
, always use adouble
annotated with@MachineSizedFloat
###Simple example
@Method(selector = "asImageWithSize:andScale:")
public native UIImage asImageWithSize(@ByVal CGSize maximumSize, @MachineSizedFloat double scale);
- Developer Guide
- Changelog
- What we're currently working on and where you can help
- F.A.Q.
- Are non libGDX iOS apps supported?
- Is there a debugger available?
- How are bindings to existing native frameworks generated?
- Who is behind this project?
- Are there any alternatives to RoboVM?
- Can RoboVM be built on Linux?
- My app is crashing without a stacktrace, what should I do?
- Is XCode interface builder supported?
- Memory Management Guide
- Howto Create an Asset Catalog for XCode 9 Appstore Submission?
- Generate Admob Bindings with bro gen Tutorial