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

Carthage support #3

Closed
antonioreyna opened this issue Sep 1, 2016 · 1 comment
Closed

Carthage support #3

antonioreyna opened this issue Sep 1, 2016 · 1 comment

Comments

@antonioreyna
Copy link

Hello,

On a new project, i am using this library via Carthage, but apparently when you use carthage there is no possibility to make the interface builder show the designable variables.

Some people propose subclassing the library classes but on this one i think is not possible to override the cornerRadius and border attributes.

Reference: here

What do you think? could it be possible to make something similar to use it with Carthage instead of cocoapods?

Thanks for this awesome project!

@juanuribeo13
Copy link
Contributor

Hey, it looks like that's a limitation that frameworks have, you can check the issue on Carthage.

Maybe subclassing will work, I tried this and there's no compiler errors, but I didn't test if that actually works.

@IBDesignable class RoundedView: RoundedViews.RoundedView {
    @IBInspectable override var radiusMultiplier: CGFloat {
        get {
            return super.radiusMultiplier
        }
        set {
            super.radiusMultiplier = newValue
        }
    }

    @IBInspectable override var borderWidth: CGFloat {
        get {
            return super.borderWidth
        }
        set {
            super.borderWidth = newValue
        }
    }

    @IBInspectable override var borderColor: UIColor? {
        get {
            return super.borderColor
        }
        set {
            super.borderColor = newValue
        }
    }
}

The thing is that you'll have to do that for every view you'll use on your project (RoundedView, RoundedButton, RoundedImage, etc). Another thing you can try is to set the radiusMultiplier and the other properties using User Defined Runtime Attributes but keep in mind that using it that way you won't see the final result in interface builder.

I'm going to close this since it looks like there's nothing we can do from our side, if you find out about something that can be done feel free to open it again.

I'm glad you like the project.

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

2 participants