Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

using attributeDict to set the properties instead of a loop.

  • Loading branch information...
commit b764520a61ba2f5ccd6c17df7d3c4aca1acf3819 1 parent 1306b56
Igor Sutton authored
Showing with 2 additions and 23 deletions.
  1. +2 −23 TKTumblelogsRequest.m
25 TKTumblelogsRequest.m
View
@@ -41,31 +41,10 @@ - (void)dealloc;
- (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName attributes:(NSDictionary *)attributeDict
{
- static NSDictionary *elementToSelectorDict = nil;
-
- if (!elementToSelectorDict) {
- elementToSelectorDict = [[NSDictionary alloc] initWithObjectsAndKeys:
- @"setTitle:", @"title",
- @"setName:",@"name",
- @"setURLWithString:", @"url",
- @"setAvatarURLWithString:", @"avatar-url",
- @"setPrimaryWithString:", @"is-primary",
- @"setTypeWithString:", @"type",
- nil];
- }
-
_currentElementName = elementName;
- if ([elementName isEqualToString:@"tumblelog"]) {
- _currentTumblelog = [[TKTumblelog alloc] init];
-
- for (NSString *key in [attributeDict keyEnumerator]) {
- SEL selector = NSSelectorFromString([elementToSelectorDict objectForKey:key]);
- if (selector && [_currentTumblelog respondsToSelector:selector]) {
- [_currentTumblelog performSelector:selector withObject:[attributeDict objectForKey:key]];
- }
- }
- }
+ if ([elementName isEqualToString:@"tumblelog"])
+ _currentTumblelog = [[TKTumblelog alloc] initWithAttributes:attributeDict];
}
- (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName
Please sign in to comment.
Something went wrong with that request. Please try again.