So I have a function that when called, needs to return a CGFloat value. However, Xcode responds with an error saying: "CGFloat is not convertible to ()". I have looked around the web, but none of the conversions seem to be working for me.
Here is my function
func update() {
point2.y += 1.39
return point2.y //<<<LINE OF ERROR<<<//
}
Your function does not specify a return type.
In Swift, you denote this with arrow (
->) notation.Try
"CGFloat is not convertible to ()" means that your method returns something of type CGFloat, when a return type of Void (or
()) is expected.