Is there any difference between a CGRect and an NSRect?

cocoa, cocoa-touch, objective-c

Solution

They're the same. This link has more information. Copied here for quick reference:

`CGRect` is the CoreGraphics equivalent of `NSRect`.

They are deliberately made to have the same layout in memory. As such, it is allowed to convert an `NSRect` to a `CGRect` by doing this:

CGRect cgrect = *(CGRect *)&nsrect;

CoreGraphics also provides a `CGRectMake()` function which works the same as `NSMakeRect()` (note the reversal of verb and object in the names) except it returns a `CGRect`.

Problem

Is there any difference between a `CGRect` and an `NSRect`? In particular, I'm wondering about the position of the origin. Are there any important differences I need to know about?

Original source