KogiMobileSAS / RoundedViews

Library that contains a collection of IBDesignable UIKit views subclases with rounded corners
MIT License
9 stars 3 forks source link

Carthage support #3

Closed antonioreyna closed 8 years ago

antonioreyna commented 8 years ago

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 commented 8 years ago

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.