Created
August 8, 2013 16:36
-
-
Save BigAB/6186275 to your computer and use it in GitHub Desktop.
A convenience thing, just some null types for common structs and a way to check for them.
Idea from this SO: http://stackoverflow.com/questions/11987142/sending-nil-to-cgpoint-type-parameter
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const CGPoint ABCGPointNull = {(CGFloat)NAN, (CGFloat)NAN}; | |
| const UIOffset ABUIOffsetNull = {(CGFloat)NAN, (CGFloat)NAN}; | |
| const CGSize ABCGSizeNull = {(CGFloat)NAN, (CGFloat)NAN}; | |
| BOOL ABCGPointIsNull( CGPoint point ){ | |
| return isnan(point.x) && isnan(point.y); | |
| } | |
| BOOL ABUIOffsetIsNull( UIOffset offset ){ | |
| return isnan(offset.horizontal) && isnan(offset.vertical); | |
| } | |
| BOOL ABCGSizeIsNull( CGSize size ){ | |
| return isnan(size.width) && isnan(size.height); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment