tolo / InterfaCSS

The CSS-inspired styling and layout framework for iOS

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Slow loading time iOS 8.4

bangerang opened this issue · comments

Hey!

I'm experiencing some latency loading css with an iPhone 5.

`[[InterfaCSS interfaCSS] loadStyleSheetFromMainBundleFile:css];``

"Loaded stylesheet 'main.css' in 2.489952 seconds"

Is there any way to optimise it?

Hey!

Sorry to hear that.

One thing you can do is to try and split up your stylesheets into multiple smaller stylesheets, and load them as needed. You can also scope stylesheets to specific parts of the application, for instance like this:

ISSStyleSheetScope* scope = [ISSStyleSheetScope scopeWithViewControllerClasses:@[BraveNewViewController.class, MyOtherBraveNewViewController.class]];
[[InterfaCSS interfaCSS] loadStyleSheetFromMainBundleFile:@"stylesForOnePartOfTheApp.css" withScope:scope];

(This won't have an impact on the actual loading time, but may improve performance when applying styles)

But other than that, optimization of stylesheet parsing (and consequently loading time) is an area that I'm planning on addressing going forward. I'm also considering adding asynchronous parsing (in a background thread) of stylesheets.

Hey again - I've just committed a significant performance optimization of the stylesheet parsing. Haven't pushed out a new release yet, but feel free to try the latest master branch version.

Yes, I see a big difference!