We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#ifndef weakify #if DEBUG #if __has_feature(objc_arc) #define weakify(object) autoreleasepool{} __weak __typeof__(object) weak##_##object = object; #else #define weakify(object) autoreleasepool{} __block __typeof__(object) block##_##object = object; #endif #else #if __has_feature(objc_arc) #define weakify(object) try{} @finally{} {} __weak __typeof__(object) weak##_##object = object; #else #define weakify(object) try{} @finally{} {} __block __typeof__(object) block##_##object = object; #endif #endif #endif #ifndef strongify #if DEBUG #if __has_feature(objc_arc) #define strongify(object) autoreleasepool{} __typeof__(object) object = weak##_##object; #else #define strongify(object) autoreleasepool{} __typeof__(object) object = block##_##object; #endif #else #if __has_feature(objc_arc) #define strongify(object) try{} @finally{} __typeof__(object) object = weak##_##object; #else #define strongify(object) try{} @finally{} __typeof__(object) object = block##_##object; #endif #endif #endif
weakify 和 strongify 是个非常常见的便捷生成__weak __typeof(self)weakSelf = self 和 __strong __typeof(weakSelf)strongSelf = weakSelf的宏定义,很多库都会有类似定义。
weakify
strongify
__weak __typeof(self)weakSelf = self
__strong __typeof(weakSelf)strongSelf = weakSelf
建议这类公共方法留给用户自己去定义,或者直接在 podspec 引用最早提出这个写法的 libextobjc:pod 'libextobjc/EXTScope'
pod 'libextobjc/EXTScope'
The text was updated successfully, but these errors were encountered:
No branches or pull requests
weakify
和strongify
是个非常常见的便捷生成__weak __typeof(self)weakSelf = self
和__strong __typeof(weakSelf)strongSelf = weakSelf
的宏定义,很多库都会有类似定义。建议这类公共方法留给用户自己去定义,或者直接在 podspec 引用最早提出这个写法的 libextobjc:
pod 'libextobjc/EXTScope'
The text was updated successfully, but these errors were encountered: