I have a problem where I am trying to center a UILabel within a programmatically generated circle (CAShapeLayer). The problem is that CAShapeLayer is not extended from UIView or NSLayoutGuide, so I am getting a runtime error with the following segment of code:
let circlePathLayer = CAShapeLayer()
let xConstraint = NSLayoutConstraint(item: statusLabel, attribute: .CenterX, relatedBy: .Equal, toItem: circlePathLayer, attribute: .CenterX, multiplier: 1, constant: 0) //Cannot set circlePathLayer
Is there an easy way to fix this?