Tracy Jr.
Tracy Jr.

Reputation: 27

How do you call python from objective-c in iOS app?

I've read a lot of articles on PyObjC and Python.framework. Most of them seem to be outdated, so I'm really confused and still looking for a GOOD solution. Here is my question:

There is an Xcode iOS project written in ObjC and e.g. .py file. How should I call python methods from ObjC? E.g. execute python code, get the result and show it in UILabel.

Moreover I'm not sure PyObjC is what I'm looking for. If you know a good approach or a good article, please share it. Thanks

Upvotes: 0

Views: 1105

Answers (1)

themantalope
themantalope

Reputation: 1040

PyObjC is not going to do this for you. It's a wrapper library, where Python code wraps Objective C code, meaning that you can use Objective C objects in a Python script, not the other way around. As far as I know, there is not an Objective C library that wraps python code. The only resource I was able to find that discusses what you want to do is here, but it doesn't exactly seem like a reputable source.

Upvotes: 1

Related Questions