I'm trying to implement a datasource that can be used to customize several different classes of cells for a tableview, but I'm having trouble with a generic type in a block that I'm passing to the constructor.
Here is the implementation of the header file of the datasource :
@interface ABParseDatasource<__covariant ObjectType: UITableViewCell *> : NSObject <UITableViewDataSource>
- (instancetype)initWithCellIdentifier:(NSString *)identifier parseQuery:(PFQuery *)query tableView:(UITableView *)tableView customizeBlock:(void (^)(ObjectType))customBlock;
@end
And here is where I'm trying to initialize the block in the constructor :
self.parseDatasource = [[ABParseDatasource alloc] initWithCellIdentifier:identifier parseQuery:[ABOrder query] tableView:self.tableView customizeBlock:^(ABOrderItemTableViewCell *cell) {
}];
The property declaration :
@property (nonatomic) ABParseDatasource<ABOrderItemTableViewCell *> *parseDatasource;
But I'm getting a compiler error when instantiating the datasource :
Any ideas? (And yes ABOrderItemTableViewCell
does inherit from UITableViewCell
)