I\'d like to create some custom views that use the @IBDesignable and @IBInspectable tags. I have added these to my Framework and then linked my Fra
I have a workaround. With this workaround, you don't need to add the framework as target. So it works with Carthage.
@IBDesignable
class MyCustomView: CustomView {
@IBInspectable override var bgColor: NSColor {
get {
return super.bgColor
}
set {
super.bgColor = newValue
}
}
}
Create a sub class (MyCustomView) of the custom class (CustomView) in the destination project (not in the framework project), and mark the sub class as @IBDesignable. Use sub class in your app. This way makes @IBDesignable work.
Inside the sub class, override those @IBInspectable properties(bgColor), this way makes @IBInspectable work.
You might encounter this issue: Loading code from a framework for a custom control in IBDesignable Following this guide to solve it: http://www.dribin.org/dave/blog/archives/2009/11/15/rpath/
And please make both the custom class and its inspectable properties public otherwise this method doesn't compile.
Please leave comments if you cannot get it work.