Swift2 中的自定义视图

Custom Views in Swift2

我有一个自定义视图,它是 UIView 的子类。我想在 storyBoard Inspector Panel 上显示它的属性,以便将来可以直接从 StoryBoard 对其进行编辑。一个例子

class CustomView : UIView {
  // This Property should be editable via StoryBoard
  var Color : UIColor = UIColor().greenColor()

}

这是怎么做的:

http://nshipster.com/ibinspectable-ibdesignable/

class CustomView : UIView {
  @IBInspectable // Add this line
  var Color : UIColor = UIColor().greenColor()
}