Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > iPhone/iPad Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Jan 13, 2013, 08:14 AM   #1
nashyo
macrumors 6502
 
Join Date: Oct 2010
Location: Bristol
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
nashyo is offline   0 Reply With Quote
Old Jan 13, 2013, 08:25 AM   #2
ArtOfWarfare
macrumors 603
 
ArtOfWarfare's Avatar
 
Join Date: Nov 2007
Send a message via Skype™ to ArtOfWarfare
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:

C
Obj-C
C++
Obj-C++

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.

Edit:

I just remembered this. You can also make a web app. You can use HTML 5, CSS 3, and Javascript (IDK what version) to make one of those.
__________________
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.
ArtOfWarfare is offline   0 Reply With Quote
Old Jan 13, 2013, 11:21 PM   #3
Albright
macrumors regular
 
Join Date: Aug 2011
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.
Albright is offline   0 Reply With Quote
Old Jan 14, 2013, 03:21 PM   #4
itsmrjon
macrumors regular
 
Join Date: Jun 2011
Location: Chicago
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/

----------
edit...
attached a SS to show the Python executing in the simulator
Attached Thumbnails
Click image for larger version

Name:	Screen Shot 2013-01-14 at 3.18.00 PM.png
Views:	362
Size:	217.2 KB
ID:	390296  
__________________
You can have your own opinions, but you can't have your own facts.
itsmrjon is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > iPhone/iPad Programming

Tags
ios, objective-c, python

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
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

Forum Jump

All times are GMT -5. The time now is 06:09 AM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC