Skip to content
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

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

Open
jeremyfa opened this issue Aug 23, 2017 · 0 comments
Open

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

jeremyfa opened this issue Aug 23, 2017 · 0 comments
Assignees

Comments

@jeremyfa
Copy link
Owner

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)

@jeremyfa jeremyfa self-assigned this Aug 23, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant