Objective-C C
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
NSDictionaryCGStruct.xcodeproj Initial import. Nov 17, 2010
.gitignore Initial import. Nov 17, 2010
LICENSE.md Added a license. Nov 17, 2010
NSDictionary+CGStructs.h Initial import. Nov 17, 2010
NSDictionary+CGStructs.m Memory leak. Nov 18, 2010
Prefix.pch Initial import. Nov 17, 2010
README.md Typo. Nov 17, 2010
main.m Initial import. Nov 17, 2010

README.md

Hopefully this will be useful to some people, simple CGPoint, CGSize and CGRect storage and retrieval from NSDictionary.

To store values into a NSMutableDictionary:

NSMutableDictionary *dictionary = [NSMutableDictionary dictionary];
[dictionary setPoint:CGPointMake(100, 200) forKey:@"pointValue"];
[dictionary setSize:CGSizeMake(500, 600) forKey:@"sizeValue"];
[dictionary setRect:CGRectMake(10, 20, 50, 60) forKey:@"rectValue"];

To retrieve values from a NSDictionary:

CGPoint point = [newDictionary pointForKey:@"pointValue"];
CGSize size = [newDictionary sizeForKey:@"sizeValue"];
CGRect rect = [newDictionary rectForKey:@"rectValue"];