Skip to content

Feature Request: Interface Builder Designable #8

@TimAEllis

Description

@TimAEllis

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 = 2

Finally you need to implement this function:

public override func prepareForInterfaceBuilder() {
    //Setup view
}

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions