Radio and PodcastRadio and PodcastLive Radio & Podcasts
Cocoa Maker 6 - Arrays, Dictionaries, and Property Lists artwork
Technology

Cocoa Maker 6 - Arrays, Dictionaries, and Property Lists

Cocoa Maker by Mr. Gecko

Mar 23, 2010Technology

James ( MrGeckosMedia.com ), joined by, Eduardo ( MegaEduX.com ), and John (@ ZimiPoder ), shows how Dictionaries, Arrays and Property Lists works in Cocoa. 12:40 Example code from episode. <Foundation/Foundation.h&gt...

About This Episode

Cocoa Maker 6 - Arrays, Dictionaries, and Property Lists is an episode from Cocoa Maker by Mr. Gecko. James ( MrGeckosMedia.com ), joined by, Eduardo ( MegaEduX.com ), and John (@ ZimiPoder ), shows how Dictionaries, Arrays and Property Lis...

Podcast

This episode belongs to Cocoa Maker.

Listen Online

Use the player on this page to stream the episode online.

Episode Details

Published Mar 23, 2010, audio available.

Questions About This Episode

What is Cocoa Maker 6 - Arrays, Dictionaries, and Property Lists about?

James ( MrGeckosMedia.com ), joined by, Eduardo ( MegaEduX.com ), and John (@ ZimiPoder ), shows how Dictionaries, Arrays and Property Lists works in Cocoa. 12:40 Example code from episode. <Foundation/Foundation.h> int main (int argc, const char * argv[]) { NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; NSLog(@"Array"); NSArray *array = [NSArray arrayWithObjects:@"Orange", @"Apple", @"Banana", nil]; for (int i=0; i<[array count]; i++) { NSLog(@"%@", [array objectAtIndex:i]); } NSLog(@"Sorting Array"); array = [array sortedArrayUsingSelector:@selector(compare:)]; for (int i=0; i<[array count]; i++) { NSLog(@"%@", [array objectAtIndex:i]); } NSLog(@"Saving Property List"); [array writeToFile:[@"~/Desktop/array.plist" stringByExpandingTildeInPath] atomically:YES]; NSLog(@"Mutable Array"); NSMutableArray *mutableArray = [NSMutableArray array]; [mutableArray addObject:@"Apples"]; [mutableArray addObject:@"Oranges"]; [mutableArray addObject:@"Bananas"]; for (int i=0; i<[mutableArray count]; i++) { NSLog(@"%@", [mutableArray objectAtIndex:i]); } NSLog(@"Removing object Oranges"); [mutableArray removeObjectAtIndex:1]; for (int i=0; i<[mutableArray count]; i++) { NSLog(@"%@", [mutableArray objectAtIndex:i]); } NSLog(@"Dictionary"); NSDictionary *dictionary = [NSDictionary dictionaryWithObjectsAndKeys:@"Oranges", @"Name", @"Fruit", @"Type", [NSNumber numberWithBool:YES], @"Seeds", nil]; NSLog(@"Adding %@ with name %@", [dictionary objectForKey:@"Type"], [dictionary objectForKey:@"Name"]); [mutableArray insertObject:dictionary atIndex:1]; for (int i=0; i<[mutableArray count]; i++) { NSLog(@"%@", [mutableArray objectAtIndex:i]); } NSLog(@"Saving Property List using NSPropertyListSerialization"); NSData *xmlData = [NSPropertyListSerialization dataFromPropertyList:mutableArray format:NSPropertyListXMLFormat_v1_0 errorDescription:nil]; [xmlData writeToFile:[@"~/Desktop/mutableArray.plist" stringByExpandingTildeInPath] atomically:YES]; NSLog(@"Mutable Dictionary"); NSMutableDictionary *mutableDictionary = [NSMutableDictionary dictionary]; [mutableDictionary setObject:@"Salad" forKey:@"Name"]; [mutableDictionary setObject:@"Veggie" forKey:@"Type"]; [mutableDictionary setObject:[NSDate date] forKey:@"Time"]; [mutableDictionary setObject:[NSNumber numberWithBool:NO] forKey:@"Seeds"]; NSLog(@"Adding %@ with name %@", [mutableDictionary objectForKey:@"Type"], [mutableDictionary objectForKey:@"Name"]); [mutableArray insertObject:mutableDictionary atIndex:0]; for (int i=0; i<[mutableArray count]; i++) { NSLog(@"%@", [mutableArray objectAtIndex:i]); } NSLog(@"Saving Binary Property List"); NSData *binaryData = [NSPropertyListSerialization dataFromPropertyList:mutableArray format:NSPropertyListBinaryFormat_v1_0 errorDescription:nil]; [binaryData writeToFile:[@"~/Desktop/bina ry.plist" stringByExpandingTildeInPath] atomically:YES]; [pool drain]; return 0; } Keynote used in this Episode Keynote in PDF Format

Where can I listen to Cocoa Maker 6 - Arrays, Dictionaries, and Property Lists?

You can listen to Cocoa Maker 6 - Arrays, Dictionaries, and Property Lists online on Radio and Podcast. Open the player on this page to stream the available audio.

Which podcast is Cocoa Maker 6 - Arrays, Dictionaries, and Property Lists from?

Cocoa Maker 6 - Arrays, Dictionaries, and Property Lists is an episode from Cocoa Maker by Mr. Gecko.

How long is this episode?

The episode duration depends on the source podcast feed and may not always be available.

When was this episode published?

This episode was published on Mar 23, 2010.

Can I save Cocoa Maker 6 - Arrays, Dictionaries, and Property Lists for later?

Yes. Use the heart button on the episode page to add it to your favorite episodes list.

Are there related episodes from Cocoa Maker?

Yes. This page shows related episodes from Cocoa Maker when more episodes are available from the podcast feed.

Quick Answers About This Episode

Where can I listen to Cocoa Maker 6 - Arrays, Dictionaries, and Property Lists?

You can listen to Cocoa Maker 6 - Arrays, Dictionaries, and Property Lists on this page when the episode audio is available from the podcast feed.

Which podcast is this episode from?

Cocoa Maker 6 - Arrays, Dictionaries, and Property Lists is from Cocoa Maker by Mr. Gecko.

What are the episode details?

Published Mar 23, 2010