![]() ![]() One of the aims of GLib/GObject libraries is to provide C API that is bindable by other languages. Gnome project (especially libraries like GLib/GObject, GTK) is a mature project with a lengthy history. There are a lot of things worth addressing. I would like to perform some additional operations for instances of Swift wrappers and then call the original swift_retain. My question is, whether I can "swizzle" a runtime method in the same manner as in Objective-C. I think I have all I need to achieve my objective already. By reading The Swift Runtime: Heap Objects // -dealloc and GitHub - wickwirew/Runtime: A Swift Runtime library for viewing type info, and the dynamic getting and setting of properties. Since hacking the GObject ref (retain) and unref (release) functions is not an option, I've focused on the Swift runtime. My problem is, that I need to release the Swift instance and the GObject instance only when there is no strong reference in either ARC (or a floating one in GObject). Therefore I am able to ensure, that at most 1 Swift wrapper instance is living at any time. I am able to pass an opaque pointer of a Swift wrapper instance to the GObject and release it upon the GObject instance destruction. My objective is to synchronize the lifecycle of GObject instance and it's Swift wrapper. The Swift wrapper already creates a Swift class definition for GObject base class and each of it's children. GTK is a C library which is based on GObject object system. There is an issue that has been bothering me for a while. I would like to improve a Swift GTK wrapper. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |