shannah / Java-Objective-C-Bridge

A thin bridge that allows for two-way communication from Java to Objective-C.
123 stars 25 forks source link

Inject NSObjects into methods called from obj-c #18

Open mojo2012 opened 5 years ago

mojo2012 commented 5 years ago

In kakao I register all NSObject subclasses globally. This allows me to get these instances later on when I only have a Proxy object:

@Msg(selector = "outlineView:numberOfChildrenOfItem:", signature = "l@:@@")
public int outlineViewNumberOfChildrenOfItem(Proxy outlineView, Proxy item) {
    return item == null ? root.childCount() : NSObject.<DataNode>getInstance(item.getPeer()).childCount();
}

It would be nice to move that functionality to JOCB's NSObject. We could then use it to directly inject the actual typed instance instead of the proxy.