Created
June 25, 2011 19:22
-
-
Save AlanQuatermain/1046799 to your computer and use it in GitHub Desktop.
A simple macro to create a non-retaining reference to an object for use within a block. For variable 'foo' will create non-retained variable '_block_foo' of type 'id'.
This file contains 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
#if __has_feature(arr) | |
# if __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_5_0 | |
# define block_unretained(obj) id _block_##obj __weak = (obj) | |
# else | |
# define block_unretained(obj) id _block_##obj __unsafe_unretained = (obj) | |
#else | |
# define block_unretained(obj) id _block_##obj __block = (obj) | |
#endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment