D.C.
D.C.

Reputation: 15588

How to wrap Objective-C, to be called from Python?

I have created an objective-C framework that I would like to import and access through a python script. I understand how to import this stuff in Python, but what do i need to do on the obj-c side to make that framework importable?

Thanks

Upvotes: 4

Views: 581

Answers (3)

jscs
jscs

Reputation: 64002

You'll want to use PyObjC, as Chuck said. Specifically, I'd suggest getting the source, which contains a collection of scripts, pyobjc-metadata (here's the readme), that doesn't seem to be included in the default Apple installation, for wrapping a framework, generating the metadata the Python side needs, and so forth.

Upvotes: 6

Chuck
Chuck

Reputation: 237060

You can just use PyObjC, which is included in Mac OS X 10.5 and later.

Upvotes: 5

Daniel DiPaolo
Daniel DiPaolo

Reputation: 56390

I'm not sure if this particular combination works, but you might be able to use SWIG to create a Python module out of your Objective-C which can then be imported into Python.

Upvotes: 2

Related Questions