Enabling Stylist designable
drekka opened this issue · comments
Derek Clarkson commented
Using Carthage, Stylist is added to my project as a framework. This means that the @IBDesignable and @IBInspectable annotations are not visible to IB and therefore I'd have to set the styles programmatically.
Instead I added the following code to the project and thought you might want to provide it as a work-a-round for other people. Just add it to the project where Stylist is being included as a framework.
import Stylist
import UIKit
/// Extensions to enable IB
@IBDesignable extension UIView {
@IBInspectable var styleName: String? {
get { return style }
set { style = newValue }
}
}
@IBDesignable extension UIViewController {
@IBInspectable var styleName: String? {
get { return style }
set { style = newValue }
}
}
@IBDesignable extension UIBarItem {
@IBInspectable var styleName: String? {
get { return style }
set { style = newValue }
}
}
Note: I don't use CocoaPods so I'm not sure if it will have the same issue.