阻止语法翻译问题Objective C to Swift

时间:2015-01-29 06:48:44

标签: ios swift translation codeblocks uipickerviewcontroller

TWPhotoPickerController *photoPicker = [[TWPhotoPickerController alloc] init];
photoPicker.cropBlock = ^(UIImage *image) {
    //do something
};
[self presentViewController:photoPicker animated:YES completion:NULL];

长期坚持这一点。我已将所有正确的头文件导入到我的桥接头文件中...只需要知道如何将此块转换为快速语法?

1 个答案:

答案 0 :(得分:2)

它应该是这样的:

var photoPicker = TWPhotoPickerController()
photoPicker.cropBlock = { (image: UIImage) -> () in
// do something
}    
presentViewController(photoPicker, animated: true, completion: nil)