Skip to content

Commit

Permalink
Merge pull request ReactiveCocoa#27 from Lightricks/feature/spaces-no…
Browse files Browse the repository at this point in the history
…t-tabs

ReactiveObjC: convert tabs to spaces.
  • Loading branch information
barakwei authored Nov 5, 2018
2 parents 1809484 + 3977e12 commit afc23f6
Show file tree
Hide file tree
Showing 142 changed files with 10,168 additions and 10,168 deletions.
16 changes: 8 additions & 8 deletions ReactiveObjC/MKAnnotationView+RACSignalSupport.m
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,16 @@
@implementation MKAnnotationView (RACSignalSupport)

- (RACSignal *)rac_prepareForReuseSignal {
RACSignal *signal = objc_getAssociatedObject(self, _cmd);
if (signal != nil) return signal;
RACSignal *signal = objc_getAssociatedObject(self, _cmd);
if (signal != nil) return signal;

signal = [[[self
rac_signalForSelector:@selector(prepareForReuse)]
mapReplace:RACUnit.defaultUnit]
setNameWithFormat:@"%@ -rac_prepareForReuseSignal", RACDescription(self)];
signal = [[[self
rac_signalForSelector:@selector(prepareForReuse)]
mapReplace:RACUnit.defaultUnit]
setNameWithFormat:@"%@ -rac_prepareForReuseSignal", RACDescription(self)];

objc_setAssociatedObject(self, _cmd, signal, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
return signal;
objc_setAssociatedObject(self, _cmd, signal, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
return signal;
}

@end
2 changes: 1 addition & 1 deletion ReactiveObjC/NSArray+RACSequenceAdditions.m
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
@implementation NSArray (RACSequenceAdditions)

- (RACSequence *)rac_sequence {
return [RACArraySequence sequenceWithArray:self offset:0];
return [RACArraySequence sequenceWithArray:self offset:0];
}

@end
50 changes: 25 additions & 25 deletions ReactiveObjC/NSControl+RACCommandSupport.m
Original file line number Diff line number Diff line change
Expand Up @@ -18,40 +18,40 @@
@implementation NSControl (RACCommandSupport)

- (RACCommand *)rac_command {
return objc_getAssociatedObject(self, NSControlRACCommandKey);
return objc_getAssociatedObject(self, NSControlRACCommandKey);
}

- (void)setRac_command:(RACCommand *)command {
objc_setAssociatedObject(self, NSControlRACCommandKey, command, OBJC_ASSOCIATION_RETAIN_NONATOMIC);

// Tear down any previous binding before setting up our new one, or else we
// might get assertion failures.
[objc_getAssociatedObject(self, NSControlEnabledDisposableKey) dispose];
objc_setAssociatedObject(self, NSControlEnabledDisposableKey, nil, OBJC_ASSOCIATION_RETAIN_NONATOMIC);

if (command == nil) {
self.enabled = YES;
return;
}
[self rac_hijackActionAndTargetIfNeeded];

RACScopedDisposable *disposable = [[command.enabled setKeyPath:@"enabled" onObject:self] asScopedDisposable];
objc_setAssociatedObject(self, NSControlEnabledDisposableKey, disposable, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
objc_setAssociatedObject(self, NSControlRACCommandKey, command, OBJC_ASSOCIATION_RETAIN_NONATOMIC);

// Tear down any previous binding before setting up our new one, or else we
// might get assertion failures.
[objc_getAssociatedObject(self, NSControlEnabledDisposableKey) dispose];
objc_setAssociatedObject(self, NSControlEnabledDisposableKey, nil, OBJC_ASSOCIATION_RETAIN_NONATOMIC);

if (command == nil) {
self.enabled = YES;
return;
}
[self rac_hijackActionAndTargetIfNeeded];

RACScopedDisposable *disposable = [[command.enabled setKeyPath:@"enabled" onObject:self] asScopedDisposable];
objc_setAssociatedObject(self, NSControlEnabledDisposableKey, disposable, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
}

- (void)rac_hijackActionAndTargetIfNeeded {
SEL hijackSelector = @selector(rac_commandPerformAction:);
if (self.target == self && self.action == hijackSelector) return;
if (self.target != nil) NSLog(@"WARNING: NSControl.rac_command hijacks the control's existing target and action.");
self.target = self;
self.action = hijackSelector;
SEL hijackSelector = @selector(rac_commandPerformAction:);
if (self.target == self && self.action == hijackSelector) return;
if (self.target != nil) NSLog(@"WARNING: NSControl.rac_command hijacks the control's existing target and action.");
self.target = self;
self.action = hijackSelector;
}

- (void)rac_commandPerformAction:(id)sender {
[self.rac_command execute:sender];
[self.rac_command execute:sender];
}

@end
32 changes: 16 additions & 16 deletions ReactiveObjC/NSControl+RACTextSignalSupport.m
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,23 @@
@implementation NSControl (RACTextSignalSupport)

- (RACSignal *)rac_textSignal {
@rac_weakify(self);
return [[[[RACSignal
createSignal:^(id<RACSubscriber> subscriber) {
@rac_strongify(self);
id observer = [NSNotificationCenter.defaultCenter addObserverForName:NSControlTextDidChangeNotification object:self queue:nil usingBlock:^(NSNotification *note) {
[subscriber sendNext:note.object];
}];
@rac_weakify(self);
return [[[[RACSignal
createSignal:^(id<RACSubscriber> subscriber) {
@rac_strongify(self);
id observer = [NSNotificationCenter.defaultCenter addObserverForName:NSControlTextDidChangeNotification object:self queue:nil usingBlock:^(NSNotification *note) {
[subscriber sendNext:note.object];
}];

return [RACDisposable disposableWithBlock:^{
[NSNotificationCenter.defaultCenter removeObserver:observer];
}];
}]
map:^(NSControl *control) {
return [control.stringValue copy];
}]
startWith:[self.stringValue copy]]
setNameWithFormat:@"%@ -rac_textSignal", RACDescription(self)];
return [RACDisposable disposableWithBlock:^{
[NSNotificationCenter.defaultCenter removeObserver:observer];
}];
}]
map:^(NSControl *control) {
return [control.stringValue copy];
}]
startWith:[self.stringValue copy]]
setNameWithFormat:@"%@ -rac_textSignal", RACDescription(self)];
}

@end
34 changes: 17 additions & 17 deletions ReactiveObjC/NSData+RACSupport.m
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,23 @@
@implementation NSData (RACSupport)

+ (RACSignal *)rac_readContentsOfURL:(NSURL *)URL options:(NSDataReadingOptions)options scheduler:(RACScheduler *)scheduler {
NSCParameterAssert(scheduler != nil);
RACReplaySubject *subject = [RACReplaySubject subject];
[subject setNameWithFormat:@"+rac_readContentsOfURL: %@ options: %lu scheduler: %@", URL, (unsigned long)options, scheduler];
[scheduler schedule:^{
NSError *error = nil;
NSData *data = [[NSData alloc] initWithContentsOfURL:URL options:options error:&error];
if (data == nil) {
[subject sendError:error];
} else {
[subject sendNext:data];
[subject sendCompleted];
}
}];
return subject;
NSCParameterAssert(scheduler != nil);
RACReplaySubject *subject = [RACReplaySubject subject];
[subject setNameWithFormat:@"+rac_readContentsOfURL: %@ options: %lu scheduler: %@", URL, (unsigned long)options, scheduler];
[scheduler schedule:^{
NSError *error = nil;
NSData *data = [[NSData alloc] initWithContentsOfURL:URL options:options error:&error];
if (data == nil) {
[subject sendError:error];
} else {
[subject sendNext:data];
[subject sendCompleted];
}
}];
return subject;
}

@end
16 changes: 8 additions & 8 deletions ReactiveObjC/NSDictionary+RACSequenceAdditions.m
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,21 @@
@implementation NSDictionary (RACSequenceAdditions)

- (RACSequence *)rac_sequence {
NSDictionary *immutableDict = [self copy];
NSDictionary *immutableDict = [self copy];

// TODO: First class support for dictionary sequences.
return [immutableDict.allKeys.rac_sequence map:^(id key) {
id value = immutableDict[key];
return RACTuplePack(key, value);
}];
// TODO: First class support for dictionary sequences.
return [immutableDict.allKeys.rac_sequence map:^(id key) {
id value = immutableDict[key];
return RACTuplePack(key, value);
}];
}

- (RACSequence *)rac_keySequence {
return self.allKeys.rac_sequence;
return self.allKeys.rac_sequence;
}

- (RACSequence *)rac_valueSequence {
return self.allValues.rac_sequence;
return self.allValues.rac_sequence;
}

@end
10 changes: 5 additions & 5 deletions ReactiveObjC/NSEnumerator+RACSequenceAdditions.m
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
@implementation NSEnumerator (RACSequenceAdditions)

- (RACSequence *)rac_sequence {
return [RACSequence sequenceWithHeadBlock:^{
return [self nextObject];
} tailBlock:^{
return self.rac_sequence;
}];
return [RACSequence sequenceWithHeadBlock:^{
return [self nextObject];
} tailBlock:^{
return self.rac_sequence;
}];
}

@end
38 changes: 19 additions & 19 deletions ReactiveObjC/NSFileHandle+RACSupport.m
Original file line number Diff line number Diff line change
Expand Up @@ -15,26 +15,26 @@
@implementation NSFileHandle (RACSupport)

- (RACSignal *)rac_readInBackground {
RACReplaySubject *subject = [RACReplaySubject subject];
[subject setNameWithFormat:@"%@ -rac_readInBackground", RACDescription(self)];
RACReplaySubject *subject = [RACReplaySubject subject];
[subject setNameWithFormat:@"%@ -rac_readInBackground", RACDescription(self)];

RACSignal *dataNotification = [[[NSNotificationCenter defaultCenter] rac_addObserverForName:NSFileHandleReadCompletionNotification object:self] map:^(NSNotification *note) {
return note.userInfo[NSFileHandleNotificationDataItem];
}];
__block RACDisposable *subscription = [dataNotification subscribeNext:^(NSData *data) {
if (data.length > 0) {
[subject sendNext:data];
[self readInBackgroundAndNotify];
} else {
[subject sendCompleted];
[subscription dispose];
}
}];
[self readInBackgroundAndNotify];
return subject;
RACSignal *dataNotification = [[[NSNotificationCenter defaultCenter] rac_addObserverForName:NSFileHandleReadCompletionNotification object:self] map:^(NSNotification *note) {
return note.userInfo[NSFileHandleNotificationDataItem];
}];
__block RACDisposable *subscription = [dataNotification subscribeNext:^(NSData *data) {
if (data.length > 0) {
[subject sendNext:data];
[self readInBackgroundAndNotify];
} else {
[subject sendCompleted];
[subscription dispose];
}
}];
[self readInBackgroundAndNotify];
return subject;
}

@end
2 changes: 1 addition & 1 deletion ReactiveObjC/NSIndexSet+RACSequenceAdditions.m
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
@implementation NSIndexSet (RACSequenceAdditions)

- (RACSequence *)rac_sequence {
return [RACIndexSetSequence sequenceWithIndexSet:self];
return [RACIndexSetSequence sequenceWithIndexSet:self];
}

@end
Loading

0 comments on commit afc23f6

Please sign in to comment.