Can we integrate and use a library written in python in iOS app?

Hello All,

I want to integrate a library available in python in iOS swift application. I have checked regarding this but only getting references for python integration in Mac system apps.

I want to know if this is possible and can we be able to call a function inside this library which is expected to return some data

Thanks.

Projects that use Python can be compiled to native, and an application could have an embedded interpreter, but if the framework is expecting to have some kind of system Python installation available, then no.

Thank you red_manance.


Please correct me if my understanding related to the response is correct. So, here there are two ways to run python library

1. compile lib to native that is static library (.a) and include it into the iOS project.

2. embed interpreter that is python.framework which works for Mac OS apps.

Note that desktop and mobile devices use different operating systems and processors. You would need to build a version of Python that can be embedded into your iOS app.

You also need to check the App Store guidelines about embedding interpreters in iOS applications. Not an expert, but, I think it's forbidden. If you can build a static library from the Python library, you will probably be better off, if you intend to submit to the App Store.

Apps need to be self-contained and can't read or write data outside their containers, or download or execute code that change its features or functionality, but there are applications in the store that contain interpreters to run code - Pythonista, for example (not to mention web browsers). But yes, for a library it would be better to build one from Python code rather than embedding a multi-megabyte interpreter for it.

Can we integrate and use a library written in python in iOS app?
 
 
Q