ClassyKit / Classy

Expressive, flexible, and powerful stylesheets for UIView and friends.
http://classykit.github.io/Classy/
MIT License
740 stars 77 forks source link

Making ClassyKit work with @IBDesignable #110

Closed rickbdotcom closed 7 years ago

rickbdotcom commented 8 years ago

I managed to get Interface Builder to display Classy styled interface elements.

@IBDesignable class ClassyButton: UIButton { override func prepareForInterfaceBuilder() { CASStyler.defaultStyler().filePath = _CASAbsoluteFilePath(#file, "stylesheet.cas") CASStyler.defaultStyler().styleItem(self) } }

I did run into an issue with the Swift class lookup as the bundle returned is different when running in IB. I'll probably need to add a method that will allow the user to explicitly set the app name from prepareForInterfaceBuilder.

rickbdotcom commented 7 years ago

I created my own branch with this functionality in it. I'll get around to creating a pull request at some point if any of you guys are interested in looking at it.