Storing CGPoint, CGSize and CGRect in Collections using NSValue

In an earlier post CGRect, CGSize and CGPoint Functions I demonstrated a number of geometry structures available for representing a point (CGPoint – x and y coordinates), size (CGSize – height and width) and rectangles (CGRect – combination of both).

Unfortunately, you cannot directly store any of the above in a collection, for example an array, as each of these is a C structure, not an object. In this post I will show you how to store CGPoint CGRect CGSize in an Objective-C collection.

Continue reading