Skip to content

Commit

Permalink
Allow requestDataForPageIndex to be an async Swift function.
Browse files Browse the repository at this point in the history
Nothing takes advantage of this yet, though.
  • Loading branch information
MaddTheSane committed Oct 25, 2021
1 parent f827470 commit 47b5894
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Classes/Managed Objects/TSSTManagedGroup.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ NS_ASSUME_NONNULL_BEGIN
@property (copy) NSString *path;
@property (copy) NSURL *fileURL;

- (void)requestDataForPageIndex:(NSInteger)index callback:(void(^)(NSData *_Nullable pageData, NSError *_Nullable error))callback;
- (void)requestDataForPageIndex:(NSInteger)index completionHandler:(void(^)(NSData *_Nullable pageData, NSError *_Nullable error))callback;
@property (readonly, strong, nullable) NSManagedObject *topLevelGroup;

/**
Expand Down
6 changes: 3 additions & 3 deletions Classes/Managed Objects/TSSTManagedGroup.m
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ - (NSData *)dataForPageIndex:(NSInteger)index
return nil;
}

- (void)requestDataForPageIndex:(NSInteger)index callback:(void(^)(NSData *_Nullable pageData, NSError *_Nullable error))callback
- (void)requestDataForPageIndex:(NSInteger)index completionHandler:(void(^)(NSData *_Nullable pageData, NSError *_Nullable error))callback
{
callback(nil, [NSError errorWithDomain:NSOSStatusErrorDomain code:unimpErr userInfo:nil]);
}
Expand Down Expand Up @@ -350,7 +350,7 @@ - (id)instance
}


- (void)requestDataForPageIndex:(NSInteger)index callback:(void(^)(NSData *_Nullable pageData, NSError *_Nullable error))callback
- (void)requestDataForPageIndex:(NSInteger)index completionHandler:(void(^)(NSData *_Nullable pageData, NSError *_Nullable error))callback
{
NSString * solidDirectory = self.solidDirectory;
NSData * imageData;
Expand Down Expand Up @@ -540,7 +540,7 @@ - (id)instance
return instance;
}

- (void)requestDataForPageIndex:(NSInteger)index callback:(void(^)(NSData *_Nullable pageData, NSError *_Nullable error))callback
- (void)requestDataForPageIndex:(NSInteger)index completionHandler:(void(^)(NSData *_Nullable pageData, NSError *_Nullable error))callback
{
[groupLock lock];
PDFPage * page = [(PDFDocument*)[self instance] pageAtIndex: index];
Expand Down
4 changes: 2 additions & 2 deletions Classes/Managed Objects/TSSTPage.m
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ - (NSImage *)textPage
__block NSData * textData;
if(self.index)
{
[self.group requestDataForPageIndex: [self.index integerValue] callback:^(NSData * _Nullable pageData, NSError * _Nullable error) {
[self.group requestDataForPageIndex: [self.index integerValue] completionHandler:^(NSData * _Nullable pageData, NSError * _Nullable error) {
textData = pageData;
}];
}
Expand Down Expand Up @@ -299,7 +299,7 @@ - (NSData *)pageData
if(self.index)
{
NSInteger entryIndex = [self.index integerValue];
[group requestDataForPageIndex:entryIndex callback:^(NSData * _Nullable pageData, NSError * _Nullable error) {
[group requestDataForPageIndex:entryIndex completionHandler:^(NSData * _Nullable pageData, NSError * _Nullable error) {
imageData = pageData;
}];
}
Expand Down

0 comments on commit 47b5894

Please sign in to comment.