home · projects · papers · blog · gallery · contact
anil madhavapeddy // anil.recoil.org

My first Cocoa steps

15 July 2006   |   Anil Madhavapeddy   |   tags:   |   all posts

mlgalleryedit Ever since I got my first Powerbook back in 2000, I’ve been meaning to learn Cocoa and Carbon to hack on MacOS X GUIs. On the flight over to San Francisco, I finally found the uninterrupted time to knock up a simple GUI interface to my gallery meta-data files. Overall, the experience was pretty positive. It’s definitely more satisfying than my experiences with Windows and UNIX GUI programming, mainly because the result is so pretty!

The APIs can be unfortunately verbose at times, as the following code snippet which does a little bit of simple string manipulation shows:

NSArray *a = [tag componentsSeparatedByString:@" "];
iter2 = [a objectEnumerator];
while (s = [iter2 nextObject]) {
    NSString *e = [s stringByTrimmingCharactersInSet:
        [NSCharacterSet whitespaceCharacterSet]];
     if (![e isEqual:@""]) 
         [tags addObject:[e retain]];

I’m quite looking forward to doing more work on this simple application now that the basics are mastered. Hmm… preferences panes next, then a bit of Cocoa bindings, and perhaps I feel OCamlCocoa coming on…

blog comments powered by Disqus