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
if [ -d "${SIMULATOR_LIBRARY_PATH}/Modules/${FRAMEWORK_NAME}.swiftmodule/" ]; then | |
cp -f ${SIMULATOR_LIBRARY_PATH}/Modules/${FRAMEWORK_NAME}.swiftmodule/* "${FRAMEWORK}/Modules/${FRAMEWORK_NAME}.swiftmodule/" | echo | |
fi | |
if [ -d "${DEVICE_LIBRARY_PATH}/Modules/${FRAMEWORK_NAME}.swiftmodule/" ]; then | |
cp -f ${DEVICE_LIBRARY_PATH}/Modules/${FRAMEWORK_NAME}.swiftmodule/* "${FRAMEWORK}/Modules/${FRAMEWORK_NAME}.swiftmodule/" | echo | |
fi |
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
[[self.viewModel.refreshCommand.executing deliverOnMainThread] subscribeNext:^(id executing) { | |
if ([executing boolValue]) { | |
[SVProgressHUD showWithMaskType:SVProgressHUDMaskTypeGradient]; | |
} else { | |
[SVProgressHUD dismiss]; | |
} | |
}]; | |
@weakify(self); | |
[[self.viewModel.refreshCommand.errors deliverOnMainThread] subscribeNext:^(NSError *error) { |
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
- (RACCommand*) refreshCommand { | |
if (_refreshCommand) | |
return _refreshCommand; | |
_refreshCommand = [[RACCommand alloc] initWithSignalBlock:^RACSignal *(id input) { | |
return [[HNClient sharedClient] topStories]; | |
}]; | |
return _refreshCommand; | |
} |
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
RACSignal *falseSignal = [RACSignal return:@(NO)]; | |
RACSignal *triggerSignal = [[RACSignal combineLatest:@[[self rac_didStartLoad], [self rac_didFinishLoad]]] map:^id(id value) { | |
@strongify(self); | |
return @(self.canGoForward); | |
}]; | |
signal = [RACSignal merge:@[falseSignal, triggerSignal]]; |
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)testNormalReturn { | |
// Create mock objects for API clients | |
id HNClientMock = OCMPartialMock([HNClient sharedClient]); | |
id RAClientMock = OCMPartialMock([ReadabilityClient sharedClient]); | |
// Stub the API responses | |
NSDictionary *HNRtn = @{@"by":@"andrewbarba", | |
@"descendants":@12, | |
@"id":@9135641, | |
@"kids":@[@9135772,@9135785], |
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
@weakify(self); | |
[[RACObserve(self.viewModel, url) deliverOnMainThread] subscribeNext:^(NSString *urlString) { | |
@strongify(self); | |
self.urlLabel.text = urlString; | |
}]; |
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
RAC(self.urlLabel, text) = [RACObserve(self.viewModel, url) deliverOnMainThread]; |
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
- (RACSignal*) topStories { | |
return [[[self rac_GET:@"topstories.json" parameters:nil] reduceEach:^id(AFHTTPRequestOperation *op, NSArray * response) { | |
return response; | |
}] deliverOn:[RACScheduler schedulerWithPriority:RACSchedulerPriorityBackground]]; | |
} |
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
POST 'http://localhost:5999/api/v3/register': { | |
"Accept-Language" = "en;q=1"; | |
"Content-Type" = "application/json; charset=utf-8"; | |
"User-Agent" = "EMQ/0.6 (iPhone Simulator; iOS 8.1; Scale/2.00)"; | |
"X-Device-ID" = 5794b6b61929b402c20be8447ef6a3e3fb1f6afc; | |
} {"password":"******","mobile_number":"+8860921607734","full_name":"Steve Jobs","email":"steve_jobs@apple.com","mobile_country_code":"tw"} | |
2015-01-28 12:33:25.234 EMQ[6238:132268] 200 'http://localhost:5999/api/v3/register' [3.2715 s]: { | |
"Content-Length" = 677; | |
"Content-Type" = "application/json"; | |
Date = "Wed, 28 Jan 2015 04:33:25 GMT"; |
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
NSURLSessionConfiguration *conf = [NSURLSessionConfiguration defaultSessionConfiguration]; | |
NSURLSession *session = [NSURLSession sessionWithConfiguration:con delegate:self delegateQueue:nil]; | |
NSURLSessionDownloadTask *task = [session downloadTaskWithRequest: req]; | |
[task resume]; | |