I Do Not Intend To Put The Project On The App Store
Short Question - is there any up-to-date PyObjC tutorial for embedding python scripts into an iOS app written in Objective-C and/or swift? If not if there any up-to-date method for achieving the same goal?
Background: I want to run a bunch python scripts in an objective-c ios app. I have tried a couple of things:
I have tried using the python.framework, but i get a "could not build Python module" error. After googling for help, I realized that python.framework does not work on iOS - Run python scripts in iOS app
PyObjC - For the sake of experimenting, I managed to get the generated *.plugin working on OS X. I followed this tutorial - https://pythonhosted.org/pyobjc/tutorials/embedded.html Using the same method on iOS, it fails to compile
Swift For TensorFlow supports Python interoperability. You can import Python modules from Swift, call Python functions, and convert values between Swift and Python.
Kivy is a Python framework that can be used to build both iOS and Android applications. Kivy is an open-source Python library that is used for the rapid development of applications that make use of innovative surfaces, such as multi-touch apps. It is 100% free to use.
Most of the core iOS and MacOs software is still written in Objective-C, though Apple is pushing for new updates to be written in Swift.
If anyone is ever interested in calling python from swift, here is some helpful material I found(used) -
Most of it is for Objective-c, but if you need to use swift you can easily just create an ObjC-Swift bridge (super-super easy) - Lookup the apple docs
I managed to get the first two methods working on an OS X app, but I got some architecture errors for iOS(not important). I've pushed the project aside for now, I have a ton I need to get done.
Hope this will be helpful for anyone interested :-)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With