I take it protocol _VectorMath is private?

I tried to divide a CGPoint like it was a vector (I indend to scale it):

somePoint / 2

I got this from Xcode:

Referencing operator function '/' on '_VectorMath' requires that 'CGPoint' conform to '_VectorMath'

I can't find a protocol named VectorMath or _VectorMath in the docs, so I'm guessing that is a protocol whose name would ideally not appear in error messages to the user. But am I wrong? Is there something I can make CGPoint conform to, and pick up a bunch of vector-like functions?

If not, they're easy enough to write.

I believe that _VectorMath is an implementation detail of SwiftUI. Ideally the compiler wouldn't mention it at all in this error message, since clients are not supposed to use it (and shouldn't need to worry about it).

Terms of Service

Privacy Policy

Cookie Policy