Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enabling Stylist designable #11

Open
drekka opened this issue Jul 25, 2018 · 0 comments
Open

Enabling Stylist designable #11

drekka opened this issue Jul 25, 2018 · 0 comments

Comments

@drekka
Copy link
Contributor

drekka commented Jul 25, 2018

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.

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

No branches or pull requests

1 participant