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
// | |
// main.m | |
// testproperties | |
// | |
// Created by Nicolas Bouilleaud on 15/03/12. | |
// Copyright (c) 2012 __MyCompanyName__. All rights reserved. | |
// | |
#import <Foundation/Foundation.h> | |
#import <objc/runtime.h> |
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
// | |
// clang main.m -framework Foundation && ./a.out | |
#import <Foundation/Foundation.h> | |
/****************************************************************************/ | |
#pragma mark - | |
@interface Advertiser : NSObject | |
@end |
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
// | |
// NSRunLoop+TimeOutAndFlag.h | |
// | |
// | |
@interface NSRunLoop (TimeOutAndFlag) | |
- (void)runUntilTimeout:(NSTimeInterval)delay orFinishedFlag:(BOOL*)finished; | |
@end |
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
// | |
// clang orderedset-kvo-test.m -framework Foundation && ./a.out | |
// | |
#import <Foundation/Foundation.h> | |
#import <objc/runtime.h> | |
#import <objc/message.h> | |
int main () | |
{ |
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
// | |
// clang orderedsets-more-kvc.m -framework Foundation && ./a.out | |
// | |
#import <Foundation/Foundation.h> | |
int main () | |
{ | |
@autoreleasepool { |
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
@import Foundation; | |
@interface A : NSObject | |
@end | |
@interface B : A | |
@end | |
// Private objc ivars are really private: | |
@implementation A | |
{ |
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
@import Foundation; | |
int main() { | |
for (int i=0; i<100; i++) { | |
NSDate * date = NSDate.date; | |
printf("%p\n",date); | |
} | |
} |
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
// | |
// clang -framework Foundation NSConstantString_test.m; ./a.out; rm ./a.out | |
// | |
#import <Foundation/Foundation.h> | |
#define PrintObjectInfo(obj) \ | |
do{id _obj = ( obj );\ | |
printf("%-61s %-20s %-16p %ld\n", #obj" :", [NSStringFromClass([_obj class]) UTF8String], _obj, [_obj retainCount]);\ | |
}while(0); |
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
#import <Foundation/Foundation.h> | |
@interface Foo : NSObject | |
@end | |
@implementation Foo | |
- (void) setBar:(void(^)(void))block {} | |
- (void) doBaz:(void(^)(void))block{} | |
@end |
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
// The behaviour for dot-syntax is inconsistent in two aspects. | |
// | |
// 1. Autocompletion | |
// @properties and instance methods declared in the @interface block are autocompleted in Xcode with the dot-syntax; | |
// However class methods and private instance method are not autocompleted, although they are perfectly valid. | |
// | |
// Moreover, the class method are suggested in autocompletion after an instance variable. | |
// (in the example below, that would be instance.classMethod. | |
// | |
// Autocompletion should be suggested whenever the syntax is valid. |
OlderNewer