I feel like I’m doing a lot of unnecessary stuff here:
- (id)init {
if ((self = [super init])) {
NSMutableArray *anArray = [[NSMutableArray alloc] init];
self.currentScopeArray = anArray;
[anArray release];
NSString *aPath = [[NSBundle mainBundle] pathForResource:@"Configuration" ofType:@"plist"];
NSMutableDictionary *aDictionary = [[NSMutableDictionary alloc] initWithContentsOfFile:aPath];
NSMutableArray *anotherArray = [[NSMutableArray arrayWithObject:[aDictionary objectForKey:@"Search"]] objectAtIndex:0];
self.defaultScopeArray = anotherArray;
[aDictionary release];
for (int x = 0; x < [self.defaultScopeArray count]; x++) {
BOOL enableCheckmark = [[[self.defaultScopeArray objectAtIndex:x] objectForKey:@"enabledByDefault"] boolValue];
if (enableCheckmark) {
if (![self.currentScopeArray containsObject:[self.defaultScopeArray objectAtIndex:x]]) {
[self.currentScopeArray addObject:[self.defaultScopeArray objectAtIndex:x]];
}
}
}
}
return self;
}
At the very least, you can replace this block:
with:
This block:
could be: