如何将swift中使用的闭包写成objective c?

How to write closure used in swift to objective c?

UIAlertController 'UIAlertAction' tag/userdata or anything in Swift

基于此解决方案,用于处理动态创建的 UIAlertController 的点击操作。

我正在搜索 objective c 将闭包转换为块的代码。

let closure = { (index: Int) in
     { (action: UIAlertAction!) -> Void in
         println("Index: \(index)")
     }
 }

我能够使用以下 Objective C 个块

  void (^closure)(UIAlertAction *) = ^(UIAlertAction *action){
        NSInteger index = [alertcontroller.actions indexOfObject:action];
        NSLog(@"Button Index%ld", (long)index);
    };