我想模仿S3,但我似乎无法想出下面的快速等价物:

- (void)listObjects:(AWSS3ListObjectsRequest *)request completionHandler:(void (^ _Nullable)(AWSS3ListObjectsOutput * _Nullable response, NSError * _Nullable error))completionHandler;

我试过很多选择:
//    func listObjects(request: AWSS3ListObjectsRequest) -> AWSTask<AWSS3ListObjectsOutput>
//    func listObjects(request: AWSS3ListObjectsRequest, completionHandler: (AWSTask<AWSS3ListObjectsOutput>) -> AnyObject?)
    func listObjects(request: AWSS3ListObjectsRequest, completionHandler: () -> AWSTask<AWSS3ListObjectsOutput>)
//    - (void)listObjects:(AWSS3ListObjectsRequest *)request completionHandler:(void (^ _Nullable)(AWSS3ListObjectsOutput * _Nullable response, NSError * _Nullable error))completionHandler;

但我好像找不到符合AWSS3的。我需要这样做来模仿Swift中的函数。

最佳答案

func listObjects(request: AWSS3ListObjectsRequest, completionHandler: ((AWSS3ListObjectsOutput?, Error?) -> Void)?) {

}

关于objective-c - 将Objective-C转换为Swift到模拟S3,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/58500377/

10-14 21:08