Hi, I tried to add a macro to convert ObjC's Class (AnyClass in Swift) to the actual type.
miku1958@e9027e4
I've added two functions here that are implemented in ObjC, and I've added them as swift versions in the example
classConforming is to retrieve the class that conform the ObjcProtocol from a dictionary, it return AnyClass
objectConforming is to retrieve the object that conform the ObjcProtocol from a dictionary, it return Any
I can't write a Swift version directly due to compiler limitations, so I'd like to borrow the Macro implementation
The problem happened when I used classConforming and convert the ObjcProtocol to:
classConforming(to: ObjcProtocol.self) as? ObjcProtocol.Type
Compiler give me this error:
Cannot convert value of type '(any ObjcProtocol.Type)?' to type '(any ObjcProtocol).Type?' in coercion
I tried to return another Generic Type or return Any directly but fail, any way I can fix it?
Thanks!
Hi, I tried to add a macro to convert ObjC's Class (AnyClass in Swift) to the actual type.
miku1958@e9027e4
I've added two functions here that are implemented in ObjC, and I've added them as swift versions in the example
classConforming is to retrieve the class that conform the ObjcProtocol from a dictionary, it return AnyClass
objectConforming is to retrieve the object that conform the ObjcProtocol from a dictionary, it return Any
I can't write a Swift version directly due to compiler limitations, so I'd like to borrow the Macro implementation
The problem happened when I used classConforming and convert the ObjcProtocol to:
classConforming(to: ObjcProtocol.self) as? ObjcProtocol.TypeCompiler give me this error:
Cannot convert value of type '(any ObjcProtocol.Type)?' to type '(any ObjcProtocol).Type?' in coercionI tried to return another Generic Type or return Any directly but fail, any way I can fix it?
Thanks!