What's cool about Key-Value Coding?

Thanks to Key-Value Coding and a nice method on NSArray you can do nice things like this…

 - (BOOL)panel:(id)sender shouldShowFilename:(NSString *)filename
 {
-    NSEnumerator *enumerator = [[self identities] objectEnumerator];
-    SSHIdentity *identity = nil;
-    while ((identity = [enumerator nextObject]))
-    {
-        if ([filename isEqualToString:[identity path]])
-            return NO;
-    }
-    return YES;
+    NSArray *filenames = [[self identities] valueForKey:@"path"];
+    return (![filenames containsObject:filename]);
 }

That’s 8 lines of messy, inefficient code replaced with 2 simple lines whose intention and purpose are much clearer.