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( .....?

Cœur
  • 37,241
  • 25
  • 195
  • 267
user523234
  • 14,323
  • 10
  • 62
  • 102
  • 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. – andykkt Feb 07 '20 at 00:11

1 Answers1

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

}
Asperi
  • 228,894
  • 20
  • 464
  • 690