[View] [Edit] [Lock] [References] [Attachments] [History] [Home] [Changes] [Search] [Help]
[chart8] Implementing the Highcharts library
How to access the library at native level
- Use the "inspect ObjC" tool or evaluate the expression
ObjCMirror tree inspect to see all the libraries accessible at runtime
- Follow the inspection path to the library e.g.
- The array exposes all the native objects accessible from library
Reflecting on ObjC objects defined by the library
- ensure you started [GCD] SystemServer (and got the URL to access the server)
- connect to chart8 system from a workspace (see workspace and remote connections) or Quick List.
- Save a global reference to library exports for exploring the contents
| appPool |
appPool := ObjCMirror tree @ #(
private var containers
HIExports := (appPool at: appPool keys asArray first) @ #(
(HIExports collect: [:each| each name]) asLiteral
Note that this evaluation leaves a global array (HIExports) with the exported objects of the library, and returns an array with the names.
You can evaluate the expression with showIt to see the names in your workspace
- Inspect the exports at any time evaluating HIExports inspect
- To inspect the hierarchy
(ObjCMirror hierarchyFrom: HIExports) inspect; size
- To generate the code of full API evaluate (with showIt):
ObjCMirror codeForExports: HIExports
What we have learned?
- Once we have embedded the library in our system, we can access the native classes exported by the library (See HIExports)
- Now we can generate the code to build a module loadable dynamically (a shareable resource in U8 service)
Want a one-line expression to build the library?
|To generate all the code evaluate the expression (with showIt)|
ObjCMirror codeForModule: #HighchartsThe returned string is the code of the implementation of the library wrappers!
If you need to regererate a class or want to build the interface of one native class, evaluate the following expression (e.g. to re-generate HIChart class):
ObjCMirror codeForClass: #HIChart.
Get the fileOut of the category evaluating (with showIt):
Exporter fileOutCategory: #Highcharts