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

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

merged 17 commits into from
Jul 12, 2016

Conversation

mikeger
Copy link
Contributor

@mikeger mikeger commented Jul 8, 2016

Hey
We are having some updates for Classy, based on our most recent usage experience:

  • Styling per window
    It might be needed to specify extra windows where Classy should apply the style, or alternatively turn it off for main window.
  • Caching
    Our CAS file is taking about 500ms to parse, so we decided to cache it to binary plist using NSCoding, Classy supports now id<CASCacheProtocol> cache property to modify the caching behaviour
  • Load on demand
    If app is starting on the background for performing the background tasks (APNS, VoIP, etc) we don't want nether to start Classy, nor to do any activity on views/windows
  • System font support
    iOS 9 added SanFrancisco font family, which is hard to mention by name

Also contains tests for some of this functionality. Sorry for such a big PR.

@mikeger mikeger merged commit a1bcfef into ClassyKit:master Jul 12, 2016
Copy link
Member

@dnedrow dnedrow left a comment

Choose a reason for hiding this comment

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

@mikeger What was the motivation behind bootStrapClassy? When I moved to v0.2.5 my styling stopped working until I called bootstrapClassy in my app delegate application:didFinishLaunchingWithOptions: method. Is that the correct place to call it?

@@ -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

@mikeger
Copy link
Contributor Author

mikeger commented Oct 19, 2017

@dnedrow it's really nice to hear that someone is using Classy in production!

Sorry for that change sneaking in, since the PR is from master to master it also included all other changes.

bootStrapClassy is useful when

  1. Your app sometimes does not need to load classy, for example when the app is started from the push notification on the background.
  2. Classy needs to know the full list of windows in the application, if you have more than one.

Real-life use example can be found here: https://github.com/wireapp/wire-ios/blob/75f558d483324946ec846a7b600fef39db8fb09f/Wire-iOS/Sources/AppRootViewController.swift

@dnedrow
Copy link
Member

dnedrow commented Oct 19, 2017

@mikeger cool, thanks. So calling bootstrapClassy as below should be an acceptable setup if there is no need for special window handling?

    [CASStyler bootstrapClassyWithTargetWindows:UIApplication.sharedApplication.windows];

@mikeger
Copy link
Contributor Author

mikeger commented Oct 19, 2017

Yes, if (1) code is not executed in the app extension (then there is no UIApplication) and (2) all your windows are loaded.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants