I have an NSValue object that can "box" an instance of an unknown type (CGPoint, CGRect, etc.) and I need to determine this type in runtime. How would I do it in Swift?
I tried to do something like this:
if ((value as Any) is CGPoint) {}
else if (((value as Any) is CGRect)) {}
...
When value
is a NSValue object containing a CGPoint, it does not get into the if clause.
Then I when I printed value
it gives me NSPoint: {150, 150}
which I assume is why it never gets in the clause.
Any ideas why this happens and how to solve it?
Thanks a lot!