Skip to content

Instantly share code, notes, and snippets.

@johnomarkid
Last active December 15, 2015 05:19
Show Gist options
  • Save johnomarkid/5207737 to your computer and use it in GitHub Desktop.
Save johnomarkid/5207737 to your computer and use it in GitHub Desktop.
DRect is a module to ease the pain of logging CGRect
DRect
=====
For iOS/OSX development.
If you are sick of NSLogging your CGRects like this:
NSLog(@"x_origin: %f, y_origin: %f, width: %f, height: %f",view.frame.origin.y, view.frame.origin.x, view.frame.size.width, view.frame.size.height);
DRect that shit.
DRect(view.frame);
Put this macro in your .pch file or somewhere else and start logging CGRects like they should be logged.
#ifdef DEBUG
# define DRect( rect ) NSLog( @"CGRect ( %f, %f, %f, %f)", rect.origin.x, rect.origin.y, rect.size.width, rect.size.height);
#else
# define DRect(...)
#endif
@NikolaKirev
Copy link

What about NSStringFromCGRect(CGRect rect) ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment