Giter Club home page Giter Club logo

Comments (4)

freakboy3742 avatar freakboy3742 commented on June 11, 2024

Yes. When you use the @objc_method decorator, that registers the method as an Objective-C entry point; it can be invoked from the Python side, or from the objective C side. This is used when you start writing handlers (e.g., button press callbacks) - you write a handler with an onPress: selector in python, and register the instance of the (Python side) handler object to the button API. when the button is pressed, it invokes onPress_()on the Python side.

The only issue then is how to pass the created object back to the objective-C side. This will usually be done by setting a property, or invoking a "setHandler:" style method, but that's up to exactly what you're implementing.

from rubicon-objc.

Siege097 avatar Siege097 commented on June 11, 2024

I am still having trouble getting objective c to see the methods I have marked with @objc_method in python. I wanted to check if I have installed rubicon correctly. I am using ios and could not figure out how to do a direct install, so I ran "setup install" on my host machine and installed the files to a temp directory. I then copied the files to my app_packages directory (I am using your cookie cutter download). I then copied the objective c test files( i.e. Example.m) into my app.

I can get some features to work I can run the python-side examples you provided in the ReadMe file. I can also create objects in python using objective c class descriptions ( i.e. the Example class files in your test library). The problem comes when I try to access anything that was created in python on the objective c side. If you had an example of how to call an object crated in python on the objective c side that would be very helpful. Thanks

from rubicon-objc.

freakboy3742 avatar freakboy3742 commented on June 11, 2024

@Siege097 The key point is that you can't just create the instance and have it "appear" in the objective C side. It needs to be passed in as an argument, or set as an attribute somewhere in the system. So - it's not enough to just create the instance - you have to "tell" the Objective C part which

You can see an example of this in the Rubicon test suite. In that example, and Handler object is instantiated; it's passed to an instance of the Example class as the callback attribute. In this case, the instance of example is being created on the Python side, but could have been created objective-C side and accessed via an attribute or method. Then, when testPeek_ and testPoke_ are invoked, the callback (defined Python side) is invoked.

from rubicon-objc.

Siege097 avatar Siege097 commented on June 11, 2024

Ok great, Thanks for your help

from rubicon-objc.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.