我完成了Creative SDK Image组件的所有步骤。但是,如何将此块转换为Swift语言..
id<AdobeImageEditorRender> render = [photoEditor enqueueHighResolutionRenderWithImage:highResImage
completion:^(UIImage *result, NSError *error) {
if (result) {
} else {
}
}];
// Provide a block to receive updates about the status of the render
[render setProgressHandler:^(CGFloat progress) {
print("Do something")
}];
答案 0 :(得分:0)
可能不是这样,因为我没有安装SDK,但它应该非常接近这个:
let render = photoEditor.enqueueHighResolutionRenderWithImage(image) { result, error in
if let result = result {
// do something with result.
} else {
// do something with error.
}
}
render.progressHandler = { progress in
// update progress, if
}
如果你在块中引用self,你需要在支撑之后放置[unowned self],如下所示:
render.progressHandler = { [unowned self] progress in
self.updateProgress(progress)
}