summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorLevi Bostian <levi.bostian@gmail.com>2013-12-26 12:20:16 -0600
committerLevi Bostian <levi.bostian@gmail.com>2013-12-30 18:14:04 -0600
commitf15a2b5f782b0f5fb2de6359353f948218860484 (patch)
tree995ff8e3a80a2cdfeefeb1b0a47ad4a430e87d11
parent18f669089e0f5a65adfdfeddaa571a801dd4b865 (diff)
Add more data type examples.
Add NSMutableSet examples.
-rw-r--r--objective-c.html.markdown11
1 files changed, 9 insertions, 2 deletions
diff --git a/objective-c.html.markdown b/objective-c.html.markdown
index 95012152..bbdbac4c 100644
--- a/objective-c.html.markdown
+++ b/objective-c.html.markdown
@@ -131,12 +131,19 @@ int main (int argc, const char * argv[])
NSDictionary *aDictionary = @{ @"key1" : @"value1", @"key2" : @"value2" };
NSObject *valueObject = aDictionary[@"A Key"];
NSLog(@"Object = %@", valueObject); // Print "Object = (null)"
- // NSMutableDictionary also available as mutable dictionary object.
+ // NSMutableDictionary also available as a mutable dictionary object.
+ NSMutableDictionary *mutableDictionary = [NSMutableDictionary dictionaryWithCapacity:2];
+ [mutableDictionary setObject:@"value1" forKey:@"key1"];
+ [mutableDictionary setObject:@"value2" forKey:@"key2"];
+ [mutableDictionary removeObjectForKey:@"key1"];
// Set object
NSSet *set = [NSSet setWithObjects:@"Hello", @"Hello", @"World", nil];
NSLog(@"%@", set); // prints => {(Hello, World)} (may be in different order)
- // NSMutableSet also available as mutable set object.
+ // NSMutableSet also available as a mutable set object.
+ NSMutableSet *mutableSet = [NSMutableSet setWithCapacity:2];
+ [mutableSet addObject:@"Hello"];
+ [mutableSet addObject:@"Hello"];
///////////////////////////////////////
// Operators