__attribute__((overloadable)) NSString *descriptionFromValue(float value) {
return @(value).stringValue;
}
__attribute__((overloadable)) NSString *descriptionFromValue(NSRange range) {
return NSStringFromRange(range);
}
__attribute__((overloadable)) NSString *descriptionFromValue(id object) {
return [object description];
}
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
// Problem: | |
// I want to hack -awakeAfterUsingCoder: which has an attribute "NS_REPLACES_RECEIVER" | |
// Now I have a block version implmentation and to be added into UIView class | |
// It works fine in ARC with right object ownership | |
// But Xcode gives me a warning "ns_consumes_self attribute only applies to methods" | |
id (^newIMPBlock)(id, NSCoder *) NS_REPLACES_RECEIVER = | |
^id (UIView *self, __unused NSCoder *decoder) NS_REPLACES_RECEIVER { | |
// Do my staff | |
}; |
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
- (void)set_:(NSInteger)_ | |
{ | |
__ = _; | |
} |