Skip to content

Instantly share code, notes, and snippets.

@jenhausu
Created January 3, 2017 09:28
Show Gist options
  • Save jenhausu/088a44acadb4e7f07c40ffa762071c28 to your computer and use it in GitHub Desktop.
Save jenhausu/088a44acadb4e7f07c40ffa762071c28 to your computer and use it in GitHub Desktop.
Array & Dictionary
NSArray *a = @[@"First",@"Second",@"Third"];
NSMutableArray *a2 = [[NSMutableArray alloc]initWithObjects:@"First",@"Second",@"Third",nil];
[a2 addObject:@"Fourth"];
let array = ["First","Second","Third"]
var array = ["First","Second","Third"]
array.append("Forth")
NSDictionary *d = [[NSDictionary alloc] initWithObjectsAndKeys:@"Value1", @"Key1", @"Value2", @"Key2", nil];
NSMutableDictionary *d2 = [[NSMutableDictionary alloc]initWithObjectsAndKeys:@"Value1", @"Key1", @"Value2", @"Key2", nil];
[d2 setObject:@"Value3" forKey:@"Key3"];
let dictionary = ["Item 1": "description", "Item 2": "description"]
var dictionary = ["Item 1": "description", "Item 2": "description"]
dictionary["Item 3"] = "description"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment