guys,
I created a swift class like this:
class SwiftClass
{
override init()
{
super.init()
}
static func Test1(closure:()->Void){
closure()
}
static func Test2(array:[()->Void]){
for closure in array {
closure()
}
}
}
Both 2 methods wok fine from swift file.
SwiftClass.Test1(closure:{print("Test1")})
SwiftClass.Test2(array:[{print("Test2_closure1")},{print("Test2_closure2")}])
The function Test1 work fine from objective-c file too.
[SwiftClass Test1WithClosure:^{
NSLog(@"SwiftClass Test1") ;
}] ;
but Test2 can't be used from objective-c file,the automatically generated -Swift.h file didn't declare it at all.
SWIFT_CLASS("_TtC17ArrayClosuresTest10SwiftClass")
@interface SwiftClass : NSObject
- (nonnull instancetype)init OBJC_DESIGNATED_INITIALIZER;
+ (void)Test1WithClosure:(void (^ _Nonnull)(void))closure;
@end
Is it possible to call Test2 from objective-c file?