-
Notifications
You must be signed in to change notification settings - Fork 467
Closed
Labels
Description
It would be really nice to be able to not only create the object in interface builder but to be able to design the object in interface builder as well.
To fix the first problem you need to replace the initWithCoder function with
required public init?(coder aDecoder: NSCoder) {`
super.init(coder: aDecoder)`
}Secondly, after // MARK: - ScrollableGraphView you need to mark the class as "designable" by adding @IBDesignable. Then for each variable which you wish to expose to interface builder you need to mark the variable with @IBInspectable. For example:
public var lineWidth: CGFloat = 2
// Will become
@IBInspectable public var lineWidth: CGFloat = 2Finally you need to implement this function:
public override func prepareForInterfaceBuilder() {
//Setup view
}joeljfischer, Coledunsby, gkye and spinach