I’m an amateur coder working on a project right now, and I was wondering if you could help me.
Basically, I’ve been doing a lot of research on a particular algorithm that I find runs much faster using Python. The goal is to get this Python code to run in my IOS application. What I’ve found is that the Python interpreter has to be embedded with the Swift application in order to do this. However, I haven’t found much useful documentation or other sources on how to do this. Do you have any suggestions or advice?
解决方案
This tutorial seems to be fairly clear and easy to follow, and cover the necessary steps. Is there any chance you could share what the algorithm in question is? It might make more sense to use C - it looks like you can mix Obj-C with Swift. That said, I am not confident that you can actually do this on iOS.
First of all, your app might not get through App Store review if it has an executable for Python in it. Apple has its own docs on embedding Python in OSX/Mac OS apps, but not for iOS.
Additionally, I don't think an official executable of Python for iOS even exists. The closest thing I could think of, or find, is Pythonista, but I believe the developer made their own version of Python for iOS.
It looks like you can export Pythonista code to stand-alone apps, although how useful this is, and weather or not you can do this for iOS, I don't know. Additionally, that feature only works with Python2. Hope this helps.