This is a Swift error, as the error message is quite misleading. The real mistake is that the cornerRadii parameter is of type CGSize , but you are passing a floating point number (compare Why the cornerRadii parameter of type CGSize is [UIBezierPath bezierPathWithRoundedRect: byRoundingCorners: cornerRadii:]? ).
This should work (Swift 1.2):
var maskPath = UIBezierPath(roundedRect: headerView.bounds, byRoundingCorners: .TopLeft | .TopRight, cornerRadii: CGSize(width: 5.0, height: 5.0))
Note that in Swift 2, the byRoundingCorners argument type has been changed to OptionSetType :
var maskPath = UIBezierPath(roundedRect: headerView.bounds, byRoundingCorners: [.TopLeft, .TopRight], cornerRadii: CGSize(width: 5.0, height: 5.0))
source share