Question : Swift ui square root
Answered by : fancy-flatworm-7imy9ovj7bjb
func hypotenuse(_ a: Double, _ b: Double) -> Double { return (a * a + b * b).squareRoot()
}
let (dx, dy) = (3.0, 4.0)
let distance = hypotenuse(dx, dy)
// distance == 5.0
Source : https://developer.apple.com/documentation/swift/double/squareroot() | Last Update : Fri, 24 Jun 22