I'm working on a custom path for UIBezierPath, and I'm getting the "Cannot assign a value of type (CGFloat) to a value of type CGFloat." I think it's because there is some issue with typecasting? How can I fix this? The warnings are popping up for the "X = (b2 - b1) / (m1 - m2)" line and "Y = m1 * X + b1" line.
func lineIntersection(m1: CGFloat, b1: CGFloat, m2: CGFloat, b2: CGFloat, inout X: CGFloat, inout Y: CGFloat) -> Bool {
if m1 == m2 {
return false
} else if X = (b2 - b1)/(m1 - m2) {
return true
} else if Y = m1 * X + b1 {
return true
} else {
return false
}
}
I'll be calling this function in another function later on
func xxx() {
var outX = CGFloat()
var outY = CGFloat()
lineIntersection(oldSlope, b1: oldIntercept, m2: newSlope, b2: newIntercept, X: &outX, Y: &outY)
}