Skip to content

Instantly share code, notes, and snippets.

Yuan Sun sunnyxx

Block or report user

Report or block sunnyxx

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@sunnyxx
sunnyxx / attribute_overloadable_test.md
Last active Jul 18, 2018
__attribute__((overloadable)) test
View attribute_overloadable_test.md
__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];
}
View gist:28d584629cca297e4517

解决多个 Xcode 导致的 N 个模拟器问题

效果(感谢汤哥的截图)

命令(来自百度知道唐代富):

  1. 彻底关闭 Xcode 和模拟器
  2. $ sudo killall -9 com.apple.CoreSimulator.CoreSimulatorService
  3. $ rm -rf ~/Library/Developer/CoreSimulator/Devices
@sunnyxx
sunnyxx / block with NS_REPLACES_RECEIVER
Created Jan 13, 2015
objc runtime block implementation with NS_REPLACES_RECEIVER
View block with NS_REPLACES_RECEIVER
// 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
};
View fuck _
- (void)set_:(NSInteger)_
{
__ = _;
}
You can’t perform that action at this time.