I have a third-party Objective-C library in my quick project, in one of the .h files, it has a typedef :
typedef void (^YDBlutoothToolContectedList) (NSArray *);
and inside the class it has the property:
@property (nonatomic, copy) YDBlutoothToolContectedList blutoothToolContectedList;
(please ignore 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 an error message:
Cannot assign value of type '([Any]) -> Void' to type 'YDBlutoothToolContectedList!'
I know that the above Objective-C code in swift would be the following:
typealias YDBlutoothToolContectedList = () -> Void
but I cannot overwrite this Objective-C file and swift cannot use the closure type, is there a possible way to solve this problem?
source share