|Jan 13, 2013, 08:14 AM||#1|
Python in iOS App
How would you integrate a language like Python into an App for iOS?
I realise there is an option to 'create a new empty file' in XCode. I assume you can just paste in some Python directly into an empty file and include some how?
Or am I being naive?
Xcode 4.5.2, SDK 6.0, OSX Mountain Lion, ARC
|Jan 13, 2013, 08:25 AM||#2|
I'm pretty sure you're being naive in thinking Python code will run on iOS.
I think you're going about this the wrong way... what is your goal here?
Simply learning a language to learn a language doesn't sound like a good use of time. You could go ahead and learn brainf*ck, but it has no practical use, so why bother (unless you're fond of tearing your hair out while debugging code.)
IE, the reason I learned the portions of C++ that I know are so that I could use OGRE 3D, a 3D graphics engine, on my iOS and OS X apps.
The only languages you're allowed to use to write iOS apps are:
Obj-C is a perfect superset of C... all valid C code is valid Obj-C code.
Most valid C code is also valid C++ code.
C++ adds in a bunch of different features from what Obj-C adds... and then they share some features in common.
Obj-C++ is a merge of Obj-C and C++... I'm not exactly sure how it works, but my understanding is that all Obj-C and/or C++ code is valid Obj-C++ code.
Battery Status - On the Mac App Store
The only app that'll estimate when your wireless devices will need their batteries changed.
Including the ones paired with other Macs on your network.
Last edited by ArtOfWarfare; Jan 13, 2013 at 08:32 AM.
|Jan 13, 2013, 11:21 PM||#3|
Well, it would be possible to put Python in an iOS app, actually, or other non-C-related languages like Lua or Ruby. I've never done anything like that, but from what I understand, it would basically involve including and compiling the Python runtime code - that is, the C code for the application which reads and interprets the Python code - in your app, then writing an Objective-C wrapper which throws a Python file into that runtime and reads whatever the results may be; either form standard output, or by directly accessing the memory structures and such that Python is using, if you need more complex integration. (This is basically what something like RubyMotion would be doing, but I couldn't find a Python equivalent after a quick search.)
Eventually you can get to a point where, yes, you can just dump some Python code into a file and manipulate the behavior of your app through that, but yeah, starting from scratch, I'm afraid it's not going to be that easy.
|Jan 14, 2013, 03:21 PM||#4|
Yes you can, there is an app called Pythonista that actually will build the Xcode project for you with the Python interpreter so you can write Python apps (using their framework).
I'm not sure exactly how they do it, but it would be a great place to start looking. http://omz-software.com/pythonista/
attached a SS to show the Python executing in the simulator
You can have your own opinions, but you can't have your own facts.
|ios, objective-c, python|
|Thread Tools||Search this Thread|
All times are GMT -5. The time now is 07:44 AM.