TestsTested | ✗ |
LangLanguage | Obj-CObjective C |
License | MIT |
ReleasedLast Release | Dec 2014 |
Maintained by Unclaimed.
Depends on: | |
Evernote-SDK-iOS | ~> 1.3.1 |
Bolts | ~> 1.0.0 |
Allow you to use BoltsFramework Tasks with Evernote API for iOS.
Instead of nested callback like this:
[notestore getDefaultNotebookWithSuccess:^(EDAMNotebook *notebook) {
EDAMNoteFilter* filter = [[EDAMNoteFilter alloc] init];
filter.notebookGuid = notebook.guid;
[notestore findNotesWithFilter:filter
offset:0
maxNotes:100
success:^(EDAMNoteList *list) {
[[list notes] enumerateObjectsUsingBlock:^(EDAMNote* note, NSUInteger idx, BOOL *stop) {
[notestore getNoteApplicationDataEntryWithGuid:note.guid key:@"MyData" success:^(NSString *entry) {
// save the result
} failure:^(NSError *error) {
// error handling
}];
}];
} failure:^(NSError *error) {
// error handling
}];
} failure:^(NSError *error) {
// error handling
}];
You can write code like this:
[[[[notestore getDefaultNotebookAsync] continueWithSuccessBlock:^id(BFTask *task) {
EDAMNotebook *notebook = task.result;
EDAMNoteFilter* filter = [[EDAMNoteFilter alloc] init];
filter.notebookGuid = notebook.guid;
return [notestore findNotesAsyncWithFilter:filter offset:0 maxNotes:100];
}] continueWithSuccessBlock:^id(BFTask *task) {
EDAMNoteList *list = task.result;
NSMutableArray* tasks = [NSMutableArray array];
[list.notes enumerateObjectsUsingBlock:^(EDAMNote* note, NSUInteger idx, BOOL *stop) {
BFTask* subtask = [[notestore getNoteApplicationDataEntryAsyncWithGuid:note.guid key:@"MyData"] continueWithSuccessBlock:^id(BFTask *task) {
// save the result
return nil;
}];
[tasks addObject:subtask];
}];
return [BFTask taskForCompletionOfAllTasks:tasks];
}] continueWithBlock:^id(BFTask *task) {
if (task.error) {
// error handling
} else if (task.exception) {
// exception handling
} else {
// task complete
}
return nil;
}];
For more details about BoltsFramework, check their repo and blog post.
MIT License.