4


I'm trying to write an IDE for the iOS and I stumbled on a problem. I of course wanted to be able to do syntax highlighting, but I have no idea how I have to get this to work.

I have been googling over a month now, but I haven't found anything useful. Most libraries are C++. That I find no problem, I know enough of C++, but they all use the Boost libraries and I heavily doubt if it's easy to install them on a jailbroken iOS device, or even compile them for the iOS on the Mac.

So I come here for help. What should I do? Should I use a PHP syntax highlighter, which always colors the whole document? Should I write a syntax highlighter my self, that doesn't use the Boost library? Or does somebody here know another library, which can be used on the iOS?

Thank you in advance,
ief2

v1Axvw
  • 3,054
  • 3
  • 26
  • 40
  • this is an IDE that will be running IN the iOS, or meant to write iOS software, but from a computer?? which languages should you highlight? – jcane86 Apr 20 '11 at 21:29
  • 1
    Maybe CoreText can help you with syntax highlighting, see the "Session 110 - Advanced Text Handling for iPhone OS" and "Session 114 - Advanced Cocoa Text Tips and Tricks", both in WWDC 2010. It won’t help with the tokenization, just with the editor itself, etc. =/ – Marcelo Alves Apr 20 '11 at 21:51
  • http://stackoverflow.com/questions/3642540/uitextview-with-syntax-highlighting – Alejandro Mar 28 '12 at 23:19

3 Answers3

1

Most Boost libraries are header-only. There are only a few Boost libraries, like those for threading and asynchronous I/O, that use a compiled library. If you've found some solutions that would work fine aside from your worries about using Boost, then I would look at them again, as they'll likely work. Even if you must use a Boost library that is not header-only, you can always build it as a static library and link that into your application, so that in the end the only thing that needs to be installed is just your app bundle.

Jeremy W. Sherman
  • 35,901
  • 5
  • 77
  • 111
1

i have a simillar problem about syntax highlighting, but i prefer to solved it using UIWebview than using core text, because that is a different pixel in rendering text in core text and UITextview (in my problem i was using a core text view that cover by uitextview), and then i try to solved using uiwebview, even i'm still on developing but i can say that it is better using uiwebview than core text, maybe you can take a look at this link http://alexgorbatchev.com/SyntaxHighlighter/ it is an open source code, but it develop using javascript.

R. Dewi
  • 4,141
  • 9
  • 41
  • 66
0

I know this is old, but in case anybody is looking for a complete syntax highlighter for iOS, there's two options:

  • Highlightr: A Swift library for syntax highlighting, supports hundreds of languages but uses JS as backend. It's fast enough for live editing, though. (Disclaimer: I am the creator of this library).

  • SyntaxKit: A native solution on early stages of development. Should support any TextMate syntax in the future.

JP Illanes
  • 3,665
  • 39
  • 56