diff --git a/Source/VSThemeLoader.h b/Source/VSThemeLoader.h index 4c2d2be..d50a13b 100644 --- a/Source/VSThemeLoader.h +++ b/Source/VSThemeLoader.h @@ -16,6 +16,8 @@ @property (nonatomic, strong, readonly) VSTheme *defaultTheme; @property (nonatomic, strong, readonly) NSArray *themes; ++ (id)newWithContentsOfFile:(NSString *)path; ++ (NSString*)defaultFilePath; - (VSTheme *)themeNamed:(NSString *)themeName; @end diff --git a/Source/VSThemeLoader.m b/Source/VSThemeLoader.m index bbbe4c6..d2d8dcb 100644 --- a/Source/VSThemeLoader.m +++ b/Source/VSThemeLoader.m @@ -20,14 +20,31 @@ @interface VSThemeLoader () @implementation VSThemeLoader ++ (id)newWithContentsOfFile:(NSString *)path { + + return [[self alloc] initWithContentsOfFile:path]; +} + + ++ (NSString*)defaultFilePath { + + return [[NSBundle mainBundle] pathForResource:@"DB5" ofType:@"plist"]; +} + + - (id)init { + return [self initWithContentsOfFile:[[self class] defaultFilePath]]; +} + + +- (id)initWithContentsOfFile:(NSString *)path { + self = [super init]; if (self == nil) return nil; - NSString *themesFilePath = [[NSBundle mainBundle] pathForResource:@"DB5" ofType:@"plist"]; - NSDictionary *themesDictionary = [NSDictionary dictionaryWithContentsOfFile:themesFilePath]; + NSDictionary *themesDictionary = [NSDictionary dictionaryWithContentsOfFile:path]; NSMutableArray *themes = [NSMutableArray array]; for (NSString *oneKey in themesDictionary) {