invert()
Inverts the transformation matrix, if possible.
Declaration
mutating func invert()Discussion
Matrices with a determinant less than the smallest valid representation of a double value and greater than zero are invalid for representing as an inverse. If this can potentially happen to the input transform, use the inverted() method instead. The inverted() method returns nil if the function can’t reliably invert the matrix.
You can calculate the determinant using the following formula:
D = (m11 * m22) - (m12 * m21)