pythonobjective-cpyobjclanguage-binding

What is PyObjC?


I understand the concept of PyObjC, but can nowhere find any information on what exactly it is or how to get started with it.

Is it like a converter, where youinput python files and get an objective c one? Or is it a library you can import to your objective c files which let's you write python in them?

Or is it something else entirely?

If anyone can give tips on how to approach it, an outline of how it works, or just some instructions on a hello world with it, I would be very grateful.


Solution

  • It's a language binding, meaning it allows you to call ObjC code from Python and vice versa. You write wrapper modules in ObjC that can be linked into the Python interpreter (which is written in C) to give it access to ObjC functions (tutorial for this use case). Apparently, the entire Cocoa framework is already wrapped, so you can use that from Python with ease.

    Vice versa, it enables you to link the Python interpreter into your ObjC app and use it to execute Python code in your app (tutorial).