Skip to content
This repository has been archived by the owner on Jun 19, 2019. It is now read-only.

Caching, styling per window, load on demand, system font support + tests #111

Merged
merged 17 commits into from
Jul 12, 2016
Merged
Show file tree
Hide file tree
Changes from 1 commit
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 Classy.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -573,6 +573,7 @@
1EC7195A1B67AE9D00700A14 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
APPLICATION_EXTENSION_API_ONLY = YES;
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
Expand All @@ -588,6 +589,7 @@
1EC7195B1B67AE9D00700A14 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
APPLICATION_EXTENSION_API_ONLY = YES;
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
Expand Down
2 changes: 1 addition & 1 deletion Classy/Parser/CASStyler.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

@interface CASStyler : NSObject

+ (void)bootstrapClassy;
+ (void)bootstrapClassyWithTargetWindows:(NSArray *)targetWindows;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@killobatt Why was this change made, and how should one bootstrap Classy now? IE., what windows are to be provided when calling this?

cc: @mikeger


/**
* Singleton instance
Expand Down
20 changes: 5 additions & 15 deletions Classy/Parser/CASStyler.m
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,14 @@ + (instancetype)defaultStyler {
return _defaultStyler;
}

+ (void)bootstrapClassy {
+ (void)bootstrapClassyWithTargetWindows:(NSArray *)targetWindows {
[UIBarItem bootstrapClassy];
[UINavigationItem bootstrapClassy];
[UITextField bootstrapClassy];
[UIView bootstrapClassy];
[UIViewController bootstrapClassy];

[[self defaultStyler] setTargetWindows:targetWindows];
}

- (id)init {
Expand Down Expand Up @@ -134,7 +136,7 @@ - (void)setVariables:(NSDictionary *)variables {
self.filePath = filePath;

// reapply styles
for (UIWindow *window in self.updatedWindows) {
for (UIWindow *window in self.targetWindows) {
[self styleSubviewsOfView:window];
}
}
Expand Down Expand Up @@ -722,18 +724,6 @@ - (CASObjectClassDescriptor *)objectClassDescriptorForClass:(Class)aClass {
return objectClassDescriptor;
}

- (NSArray *)updatedWindows
{
NSMutableArray *windows = [NSMutableArray new];
if (UIApplication.sharedApplication.windows != nil) {
[windows addObjectsFromArray:UIApplication.sharedApplication.windows];
}
if (self.targetWindows) {
[windows addObjectsFromArray:self.targetWindows];
}
return windows;
}

#pragma mark - sceduling

- (void)updateScheduledItems {
Expand Down Expand Up @@ -781,7 +771,7 @@ - (void)reloadOnChangesToFilePath:(NSString *)filePath {
self.filePath = _watchFilePath;

// reapply styles
for (UIWindow *window in self.updatedWindows) {
for (UIWindow *window in self.targetWindows) {
[self styleSubviewsOfView:window];
}
});
Expand Down