Objective c 什么';这个语法在objc中的意思是什么?

Objective c 什么';这个语法在objc中的意思是什么?,objective-c,swift2,Objective C,Swift2,我正在创建一个模块swift我希望我可以转换代码swift。您能告诉我使用的方法声明类型是什么吗?它使用的是什么 -(void)sync:(void (^)(UIBackgroundFetchResult result))handler { // Make sure not to launch to syncing process at the same time if(syncing) { if(handler) { handler(UIBackgroundFetch

我正在创建一个模块swift我希望我可以转换代码swift。您能告诉我使用的方法声明类型是什么吗?它使用的是什么

-(void)sync:(void (^)(UIBackgroundFetchResult result))handler {

// Make sure not to launch to syncing process at the same time
if(syncing) {
    if(handler) {
        handler(UIBackgroundFetchResultNoData);
    }
    return;
}

syncing = YES;

[[VDARSDKController sharedInstance].afterLoadingQueue addOperationWithBlock:^(void) {
    dispatch_async(dispatch_get_main_queue(), ^(void) {

        NSArray *tags = nil;

        // If you need to synchronize with tags, you can add some tags this way:
        tags = @[ [VDARTagPrior tagWithName:@"BusDev"] ];

        //Synchronize the local DB. The old models which are not anymore needed will be automatically deleted.
        [[VDARRemoteController sharedInstance] syncRemoteModelsAsynchronouslyWithPriors:tags withCompletionBlock:^(id result, NSError *err) {
            syncing = NO;
            NSLog(@"PixLive System got the following models: %@",result);

            if(err)
                NSLog(@"The system got an error: %@",err);

            if(handler) {
                handler(err ? UIBackgroundFetchResultFailed : UIBackgroundFetchResultNewData);
            }
        }];

    });

}];
}

该方法的直译为:

func sync(handler: ((result: UIBackgroundFetchResult) -> ())?) {

    guard let handler = handler else {
        return
    }

    if syncing {
        handler(result: .NoData)
        return
    }

    syncing = true

    VDARSDKController.sharedInstance().afterLoadingQueue.addOperationWithBlock {
        NSOperationQueue.mainQueue().addOperationWithBlock {
            let tags = [VDARTagPrior.tagWithName("BusDev")]
            VDARRemoteController.sharedInstance.syncRemoteModelsAsynchronouslyWithPriors(tags) { [unowned self] result, error in
                syncing = false
                NSLog(@"PixLive System got the following models: \(result)");

                if let error = error {
                    NSLog(@"The system got an error: \(err)");
                    handler(result: .Failed)
                } else {
                    handler(result: .NewData)
                }
            }
        }
    }
}

这是一个街区。最接近的
swift
等价物是闭包。