views:

586

answers:

5

I'm considering using YAML as part of my next iPhone application, but I haven't been able to find an Objective-C library to use.

The Wikipedia page for YAML mentions one, but the link is dead.

Is there an Objective-C library that can parse YAML into native collection objects (NSArray, NSDictionary, etc...)?

A: 

I found this right from YAML's front page. But it looks like it might be out of date (c. 2004?), and the CVS link doesn't work for me.

I would bet that it's just a thin wrapper around an underlying C library like this or this... C code being "native" code that the Objective-C compiler will grok.

Shaggy Frog
Yeah, that's essentially what I'd like. I know I could just use the C or C++ YAML parsers, but I would really like to have the wrapper around it that returns the right collections and NSStrings rather than char*
Ben S
I hear what you're saying. Unfortunately, it looks like there's no one making that wrapper anymore. I'd follow up with their mailing list directly... maybe someone's got one tucked away that they haven't released yet.
Shaggy Frog
+1  A: 

The Cocoa extensions for Syck are probably what you're looking for -- it's where the library that Shaggy Frog mentioned seems to be living these days.

John Biesnecker
+1  A: 
vizionary
+1  A: 

The YAMLKit framework is a thin wrapper around LibYAML. It does exactly what you want. For example:

[[YKParser alloc] init];
[p readString:@"- foo\n- bar\n- baz"];
id result = [p parse];
/* result is now an NSArray containing an NSArray with elements:
   @"foo", @"bar", @"baz" */
[p release];
sebnow
+1  A: 

You can try YAML.framework it's LibYAML based, it's fast and easy to use. Follows the same pattern as standard NSPropertyListSerialization.

You can use it for iOS (iPhone/iPad) development.

Mirek Rusin