Skip to content
This repository was archived by the owner on Apr 17, 2019. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Source/VSThemeLoader.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
21 changes: 19 additions & 2 deletions Source/VSThemeLoader.m
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down