Skip to content

Instantly share code, notes, and snippets.

@spetschu
Created February 28, 2014 18:39
Show Gist options
  • Save spetschu/9276969 to your computer and use it in GitHub Desktop.
Save spetschu/9276969 to your computer and use it in GitHub Desktop.
Debug macros
#define DEBUG_ON // Set to DEBUG_OFF to toggle
#ifdef DEBUG_ON
#define debug(format, ...) CFShow((__bridge void *)[NSString stringWithFormat:format, ## __VA_ARGS__]);
#else
#define debug(format, ...)
#endif
#define debugRect(rect) debug(@"%s x:%.2f, y:%.2f, h:%.2f, w:%.2f", #rect, rect.origin.x, rect.origin.y, rect.size.height, rect.size.width)
#define debugSize(size) debug(@"%s h:%.2f, w:%.2f", #size, size.height, size.width)
#define debugPoint(point) debug(@"%s x:%.2f, y:%.2f", #point, point.x, point.y)
#define debugCoord2D(coord) debug(@"%s lat:%.6f, lon:%.6f", #coord, coord.latitude, coord.longitude)
#define debugImage(image) debug(@"%s h:%.2f, w:%.2f", #image, image.size.height, image.size.width)
#define debugFrame(frame) debug(@"%s x:%.2f, y:%.2f, h:%.2f, w:%.2f", #frame, frame.origin.x, frame.origin.y, frame.size.height, frame.size.width)
#define debugView(view) debug(@"%s x:%.2f, y:%.2f, h:%.2f, w:%.2f", #view, view.frame.origin.x, view.frame.origin.y, view.frame.size.height, view.frame.size.width)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment