|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.
Don't tell me Macs don't last: 2007 iMac, 2007 Mac Mini, 2008 MacBook Air, all Vintage.
(iMac obsoletion: April 28, 2015, MBA: October 14, 2015, Mac Mini: March 9, 2016)
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|
|thread||Thread Starter||Forum||Replies||Last Post|
|Nokia Pulls 'HERE' Maps App for iOS, Citing iOS 7 Changes That 'Harm the User Experience'||MacRumors||MacRumors.com News Discussion||156||Dec 30, 2013 10:54 PM|
|Amazon Pushes Mandatory Update for Kindle iOS App Ahead of iOS 7 Launch||MacRumors||iOS Blog Discussion||18||Sep 9, 2013 05:34 PM|
|Python.app||ThunderBow||Mac Programming||2||Apr 24, 2013 12:27 PM|
|Google Play Catching iOS App Store in Download Volume, but iOS Still Dominating Revenue||MacRumors||MacRumors.com News Discussion||135||Apr 23, 2013 07:39 AM|
|[FREE iOS Game Sharing] Dragon Runaway available on iOS App Store for iPhone, iPad an||Aimeejoy||iPhone and iPod touch Apps||0||Dec 10, 2012 10:22 PM|
All times are GMT -5. The time now is 07:14 PM.