[View]  [Edit]  [Lock]  [References]  [Attachments]  [History]  [Home]  [Changes]  [Search]  [Help] 

[chart8] Implementing the Highcharts library

How to access the library at native level

  1. Use the "inspect ObjC" tool or evaluate the expression
    ObjCMirror tree inspect
    to see all the libraries accessible at runtime
  2. Follow the inspection path to the library e.g.
    private/var/containers/Bundle/Application/[application ID]/chart8.app/Frameworks/Highcharts.framework/Highcharts
  3. The array exposes all the native objects accessible from library

Reflecting on ObjC objects defined by the library

  1. ensure you started [GCD] SystemServer (and got the URL to access the server)
  2. connect to chart8 system from a workspace (see workspace and remote connections) or Quick List.
  3. Save a global reference to library exports for exploring the contents
    | appPool |
    appPool := ObjCMirror tree @ #(
    	private var containers
    	Bundle Application
    ).
    HIExports := (appPool at: appPool keys asArray first) @ #(
    	'chart8.app' Frameworks
    	'Highcharts.framework'
    	Highcharts
    ).
    (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
  4. Inspect the exports at any time evaluating HIExports inspect
  5. To inspect the hierarchy
    (ObjCMirror hierarchyFrom: HIExports) inspect; size
  6. To generate the code of full API evaluate (with showIt):
    ObjCMirror codeForExports: HIExports

What we have learned?

  1. Once we have embedded the library in our system, we can access the native classes exported by the library (See HIExports)
  2. 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?

Uploaded Image: alert.gifTo generate all the code evaluate the expression (with showIt)
ObjCMirror codeForModule: #Highcharts
The 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