I have a third party Objective-C library in my swift project, in one of the .h files, it has a typedef:
typedef void (^YDBlutoothToolContectedList) (NSArray *);
and inside the class, it has a property:
@property (nonatomic, copy) YDBlutoothToolContectedList blutoothToolContectedList;
(please ignore its spelling)
When I try to use this property in my swift class, I use
bt.blutoothToolContectedList = {(_ tempArray: [Any]) -> Void in
self.devices = tempArray
self.tableView.reloadData()
}
and I got the error says:
Cannot assign value of type '([Any]) -> Void' to type 'YDBlutoothToolContectedList!'
I know the above Objective-C code in swift would be:
typealias YDBlutoothToolContectedList = () -> Void
but I can't re-write that Objective-C file and swift can't cast the closure type, is there a possible way to solve this problem?