I want to subclass UIView in swift, and CAShapeLayer - the layer type for this subclass - overriding the layer type with layerClass ().
How can I access properties that are in CAShapeLayer but not in CALayer - for example, in the example below. The code below does not compile because the path is not a member of CALayer.
override class func layerClass() -> AnyClass {
return CAShapeLayer.self
}
override func awakeFromNib() {
var path: UIBezierPath = UIBezierPath.init(ovalInRect: CGRectMake(0, 0, 30, 10))
self.layer.path = path.CGPath
}
source
share