Skip to content

Wrap ObjC objects with a Haxe class (written in Haxe) #2

Description

@jeremyfa

At the moment, the (Haxe compatible) class that wraps Objective C objects is written in C++ (taken from HXCPP itself).

This is a problem in a sense that it increases the chances to break if HXCPP changes internals on how it implements Haxe classes in C++. It also makes it more difficult to add additional helpers on this wrapper class (like an explicit release() method).

Instead, we can create a regular Haxe class that wraps and retain an Objective-C object, and releases it when being destroyed.

We could provide an explicit release() method on this ObjcWrap class, but also automatically release the Objective-C object when the wrapper is being Garbage Collected, thanks to cpp.vm.Gc.setFinalizer().

(the setFinalizer() solution was already experimented there: https://github.com/jeremyfa/hx2objc/blob/master/hx2objc/IDHolder.hx)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions