9

I am developing and iOS app and would like to know if it is possible to use python scripts in Xcode to develop my app.

I am comfortable with objective C and I am not aiming to create my entire app using python. Most of the code will still be in objective-C. The algo that I am using is very computationally intense; and so I thought using python (along with numpy and scipy) would speed things up.

I have heard that PyObjC 'may' be useful, but I have found threads on stackoverflow stating that PyObjC is not compatible with XCode 4.

Also, is there any other better suited alternative to perform computationally heavy tasks in iOS.

Thank you for answering, in advance.

Satyam Merja
  • 91
  • 1
  • 1
  • 2
  • 1
    What makes you think that Python, even with numpy/scipy, would be faster for a "computationally intense" algorithm than Objective-C? – Daniel Roseman Feb 10 '13 at 04:40
  • 2
    If he's more fluent with python, his coding could be cleaner and his implementations of algorithms more efficient. – Snakes and Coffee Feb 10 '13 at 04:41
  • Yes, I am better with python, which will mean faster implementation of algorithms. Also, the algo has a lot of matrices manipulation (fft, filters, etc.), so using numpy/scipy should result in faster run time. – Satyam Merja Feb 10 '13 at 04:49
  • 4
    In terms of execution efficiency, numpy and scipy use other libraries like LAPACK to do the real work. These libraries should be callable from Objective-C too, assuming there's an iOS version of them. Admittedly, this doesn't address the desire to use Python as a language. – Mr Fooz Feb 10 '13 at 04:57
  • 1
    for FFT & co it would be best to use Apple's accelerate framework as it has platform optimizations for each device (NEON extension to ARM, VFPv4 on iPhone 5 and so on). https://developer.apple.com/library/ios/#documentation/Accelerate/Reference/vDSPRef/Reference/reference.html#//apple_ref/doc/uid/TP40009464 – Martin Ullrich Feb 10 '13 at 10:23
  • 2
    This isn't a duplicate of the linked question. The linked question refers to an approach to the answer that doesn't work. This is asking what DOES work. – Shayne Dec 16 '13 at 17:04

1 Answers1

5

I tried to install PyObjC and I finally got it running after five hours of reading stackoverflow and docs. For me this link worked like a charm: https://github.com/gregneagle/Xcode4CocoaPythonTemplates (without GUI, also see this answer). See this link for an example of using PyObjC with iOS.

Community
  • 1
  • 1
Sitses
  • 318
  • 2
  • 11