i'm looking for a objective-c class that supports syntax hightlighting a string.
is there something like that existing?
this should work on iphone!
Firstly, it really depends on what programming language you need to process, so you should include that.
Secondly, while I don't know of any syntax highlighters that are written in C or ObjC, there are several written in JS. You could load up the code in a UIWebView and run the JS syntax highlighter on it. That would probably work pretty well.
You'll have to do this yourself, unfortunately. But if you check iPhone OS 3.2, there are some helpful bits in there. (There is an NDA in place, so more can't be revealed directly in this public area. Check out Apple's dev forums.)
Though CoreText precisely does what you want in Mac OS X, It's not yet available on iPhone OS 3.1.X. However, Syntax highlighting is far more easier if you use javascript based highlighter as pointed by Colin
Related
I am searching a syntax highlighter for iphone. I've search in this forum and in google, and I have found several answers, but I can't find the answer that I'm searching.
I want a library or a framework that can be imported to my project that includes syntax highlighting for the more languages possible, but the most important is objective-c. I would prefer if it's not in a UIWebView.
Sorry if the question isn't very exact, I'm pretty new in ios development, ask me by the comments if you need more information.
You may try OkudaKit or UKSyntaxColoredTextDocument.
Not sure if they will compile for iOS, but I think these are your best guesses...
Otherwise, try ParseKit, and do the syntax highlighting part yourself with NSAttributedString.
I'm coding a game for iphone in ooc language (a new language that compiles to c) using OpenGL. It's really going well, and ooc is a language I really like. Now I've just found out about Vala and I don't get very well what it means that it relies on GLib and GObject. I've read in another question that Vala depends on GTK, but I don't think it does.
The question is: What I'm doing with ooc, could I do the same with Vala? Can I code in vala an OpenGL game for IPhone? And can be vala code used from c?
Thanks.
Vala's object orientation is implemented using the GObject library, which is part of GLib. It is possible to use Vala without objects, and therefore not requiring GLib, but there's not much point to that.
In any case, to access a C library from Vala, somebody needs to have written a VAPI binding (see Google) for that library. There probably isn't one for Apple APIs, so you'd have to write it yourself - if that's even allowed by the Apple license agreement.
You can find old version of native vala compiler and libgee for iOS in this repo: cydia.radare.org (valac version is 0.15, it is very old). UPD: valac 0.34.4 was added, which is relatively new.
It is possible to compile GLib for iOS, so having vala code compiled should not be a problem. The real difficulty here comes with the bindings as already mentioned, I doubt that someone already has VAPIs for iOS.
I want to be able to browse through the source code of an iPhone application in windows. I do not want to compile and run the code, just need to have some kind of tool that understands the Objective-C code and iPhone application source structure. Something that view the source code as a whole (project-based) and ideally can link different classes and methods. Something more than just a plain editor with code styling and something less than a full feature IDE. Do you suggest any tools?
Most editors will support Objective-C syntax highlighting. Personally I use VIM or NotePad++. I would recommend NotePad++ for ease of use. But as far as I know there is no 'IDE' for Objective-C for Windows.
I use jEdit if I need to see the source code in Windows. Pretty much handles all the structure and syntax highlighting of objective C.
EDIT: Its an editor. Not a IDE. But with your needs of just viewing code, I guess it must suffice.
If you want a bit more than just syntax highlighting, GNUStep has an IDE called PRoject Center. GNUStep can run on Windows, so allegedly Project Center will too.
Emacs has good syntax and indentation support for Objective-C, for example it can indent the method calls the way Xcode does (based on ':') and there's a Windows version of it available here.
Though it's not an IDE, most of the time I use it for Obj-C/GNUstep without much problems.
If you use something like ctags to tag your source code you could use any editor with support for ctags.
It looks like ctags does not support Objective-C directly, but it is fairly easy to add a new language configuration to ctags.
Is it possible to call a Common Lisp function in iOS?
If so, is it possible create it in a dynamic library?
It depends on what you mean by calling a CL function, but most likely ECL will be your shortest path. Start here, as there is a patch for ECL to better accommodate iOS: http://funcall.posterous.com/tag/iphone
ECL generates C code, so you should be in safe territory with Apple's shifting policies.
Have you tried MOCL?
According to the website "mocl is a highly optimizing CL implementation, delivering tight native code via LLVM/Clang".
Maybe you can create a dynamic library, though it is designed for use the other way around.
Clozure Common Lisp (CCL) runs in Linux on the ARM, and Gary Byers long ago made an experimental iPhone version, but it would only run on a jail-broken iPhone. The problem is that the CCL compiler writes executable code, but iOS out-of-the-box does not allow a writable page to be made executable, so you can't ever RUN that code.
We've had discussions about putting the code that ships with an iOS app be in a read-only code section, and adding a byte-code compiler, so that code created at run-time can be fairly quickly interpreted, but nobody has offered to fund that project, so it hasn't gotten done.
You might think that we could just interpret code created at run-time, but the current CCL "interpreter" compiles non-trivial code before executing it.
MOCL is probably your best option to write code callable from other apps, but that's only a guess, since I haven't used it.
You could use Gambit Scheme or Clozure Common Lisp, both are able to interface with Cocoa, the first because it generates C and the latter because there is a bridge from Clozure to Cocoa. Do a google search about it and you will find a few things.
You might want to keep an eye on this (new) project. It will be publicly available during October 2019: EQL5 iOS EQL5 iOS libs
There also exists Mobile Common Lisp1
I'm looking to customise the behaviour of a UITextView quite dramatically - adding in regex-based highlighting, line numbers and find and replace - as I essentially want to create a text editor on the iPhone/iPad.
I've been looking through the UITextView reference but it seems to be very restricted, not very customisable at all. I don't really know the underlying frameworks very well, so any help would be appreciated. My lack of in-depth knowledge notwithstanding, I want to do something pretty advanced, so any help at all would be really really appreciated.
My best,
Jamie
Unfortunately what you're seeing with UITextView is exactly what you get. It's not designed to support the kind of features you describe.
In the latest iPhone OS your best bet would be to deploy a Javascript-based editor in a UIWebView. Do the text handling in JS. Yeah, that's probably no fun, but unlike UITextView it's actually possible.
Alternately code your own text view from the ground up. Again, no fun, but has the benefit of being possible.
If you have access to pre-releases of future iPhone OSs, watch for new improvements and features. Apple's demo of Pages for iPad clearly uses something more sophisticated than the current UITextView, and the iWork apps supposedly use only public APIs. That would imply something closer to what you need will be available in a future release.