// 2010-1-1 11:10:05
NSDate *date = [NSDate AZ_dateByUnit:@{
AZ_DateUnit.year : @2010,
AZ_DateUnit.month : @1,
AZ_DateUnit.day : @1,
AZ_DateUnit.hour : @11,
AZ_DateUnit.minute : @10,
AZ_DateUnit.second : @5
}];
objc/runtime.h
は使わないで KVO で実装@interface ExampleConfig : SimpleUserDefaults
@property (nonatomic) NSString *name;// <- getter/setter access NSUserDefaults
@property (nonatomic) BOOL hasBoolValue;
@end
@implementation ExampleConfig
- (id)init {
self = [super init];
if (self == nil) {
return nil;
}
// initialize NSUserDefaults target
[self addObserverSelector:@selector(name)];
[self addObserverSelector:@selector(hasBoolValue)];
return self;
}
@end
:Name :Total(s) :Avg.(s) -[Bench test_benchSimpleUserDefaults_init] 0.01163 0.00001 (1/1000) -[Bench test_benchSimpleUserDefaults_read] 0.00019 0.00000 (1/1000) -[Bench test_benchSimpleUserDefaults_write] 0.00020 0.00000 (1/1000) // 素の実装 -[Bench test_benchStandardUserDefaults_init] 0.00129 0.00000 (1/1000) -[Bench test_benchStandardUserDefaults_read] 0.00087 0.00000 (1/1000) -[Bench test_benchStandardUserDefaults_write] 0.00021 0.00000 (1/1000) // runtimeの実装 -[Bench test_benchGVUserDefaults_init] 0.02315 0.00002 (1/1000) -[Bench test_benchGVUserDefaults_read] 0.00021 0.00000 (1/1000) -[Bench test_benchGVUserDefaults_write] 0.01373 0.00001 (1/1000)
XCTestCase
のサブクラスとして実装@interface YourBenchmarkTestCase : AZBenchmarkTestCase
@end
@implementation YourBenchmarkTestCase
- (void)benchYourTest{
// ベンチを取りたい処理を書く
}
@end
then
や when
を使うNSMutableArray *race = [NSMutableArray array];
NSBlockOperation *blockOperation1 = [NSBlockOperation blockOperationWithBlock:^{
[race addObject:@1];
}];
NSBlockOperation *blockOperation2 = [NSBlockOperation blockOperationWithBlock:^{
[race addObject:@2];
}];
NSBlockOperation *blockOperation3 = [NSBlockOperation blockOperationWithBlock:^{
[race addObject:@3];
}];
NSOperationQueue *queue = [[NSOperationQueue alloc] init];
[OperationPromise promise:queue]
.then(blockOperation1)
.then(blockOperation2)
.then(blockOperation3)
.start();
// @1 -> @2 -> @3 という順番で実行される
UIButtonTypeRoundedRect
風のボタンを使えるNSManagedObject
<-> NSDictionary
Mantle
とか@interface CounterAgent : NSObject
#pragma mark - count
- (NSUInteger)countOfCurrentVersion;
#pragma mark - count up
+ (void)countUp;
- (void)countUp;
#pragma mark - fire event
- (void)runObserver:(id) observer selector:(SEL) selector whenCount:(NSUInteger) count;
#pragma mark - reset
- (void)resetCount;
@end
Table of Contents | t |
---|---|
Exposé | ESC |
Full screen slides | e |
Presenter View | p |
Source Files | s |
Slide Numbers | n |
Toggle screen blanking | b |
Show/hide slide context | c |
Notes | 2 |
Help | h |