0
我有一个Swift项目,我正在使用Objective C自定义手势识别器。Objective-C的语法转换为Swift ^()
我已经成功地转换了一切,直到现在。不能完全数字如何转换,return ^(UITableView *tableView, NSIndexPath *indexPath) { };
我试过的一切都没有编译。
目标C代码:
typedef void(^DRCellSlideActionBlock)(UITableView *tableView, NSIndexPath *indexPath);
typedef void(^DRCellSlideActionStateBlock)(DRCellSlideAction *action, BOOL active);
-(void)doSomething{
squareAction.didTriggerBlock = [self pushTriggerBlock];
}
- (DRCellSlideActionBlock)pushTriggerBlock {
return ^(UITableView *tableView, NSIndexPath *indexPath) {
NSLog(@"Do Something");
}]];
[self presentViewController:alertController animated:YES completion:nil];
};
}
我已经试过:
错误:连续的语句一定要分开....
return (tableView: UITableView, indexPath: NSIndexPath) in {
}
还试图以此为完成(UIView.animateWithDuration
):
错误:连续的语句一定要分开....
return() -> (tableView: UITableView, indexPath: NSIndexPath) in {
顺便说一句,我有点新的斯威夫特所以原谅我的代码
谢谢你的帮助 –