2

I have this Objective-C code in FileManagerHelper:

+(void)getMyVideoObject:(NSString *)videoId completion:(void (^)(MyVideoObject *myVideoObject, NSError *error)) completionBlock
{

}

For calling from Objective-C:

 [FileManagerHelper getMyVideoObject:videoId completion:^(MyVideoObject *myVideoObject, NSError *error) {

}];

But how do I call this getMyVideoObject from Swift?

FileManagerHelper.getMyVideoObject( .....?

1
  • 2
    Yes, when you import header file into bridge header then Swift will generate Swift version of function signature and you can call it like that. Commented Feb 7, 2020 at 0:11

1 Answer 1

1

1) Add into your bridging header (-Bridging-Header.h file generated when you add .swift file to Objective-C project)

#import "FileManagerHelper.h"

2) In swift code use the following call

FileManagerHelper.getMyVideoObject("id") { (video, error) in

}
Sign up to request clarification or add additional context in comments.

1 Comment

Did not know in Swift video and error do not need to be declared. Thanks.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.