mirror of
https://github.com/nickshanks/ResKnife.git
synced 2024-06-06 20:29:29 +00:00
Fast enumeration & fix self-checking in initForType:.
This commit is contained in:
parent
0fbb82af18
commit
559e3fa755
|
@ -13,13 +13,12 @@
|
|||
- (id)initForType:(NSString *)typeString
|
||||
{
|
||||
self = [super init];
|
||||
type = [typeString copy];
|
||||
data = [[NSMutableDictionary alloc] init];
|
||||
{
|
||||
id <ResKnifeResourceProtocol> resource;
|
||||
if (self) {
|
||||
type = [typeString copy];
|
||||
data = [[NSMutableDictionary alloc] init];
|
||||
NSArray *resources = [NSClassFromString(@"Resource") allResourcesOfType:type inDocument:nil]; // nil document will search in ANY open document for the correct resource
|
||||
NSEnumerator *enumerator = [resources objectEnumerator];
|
||||
while( resource = [enumerator nextObject] )
|
||||
while( id <ResKnifeResourceProtocol> resource in resources )
|
||||
[data setObject:[resource name] forKey:[resource resID]];
|
||||
}
|
||||
parsed = [[NSMutableArray alloc] initWithArray:[data allValues]];
|
||||
|
|
Loading…
Reference in New Issue
Block a user