objective c - Swift/ObjectiveC interoperability: closure property 'not found on object of type *' -
in swift class, have defined 2 closure properies so:
var confirmationhandler: ((address: address, refinedcoordinate: cllocationcoordinate2d?) -> void)? var anotherhandler: ((address: address, refinedcoordinate: cllocationcoordinate2d) -> void)? when try set former objective c code, following error:
property 'confirmationhandler' not found on object of type...
i have no trouble setting latter. why this?
got answer off of post here: https://stackoverflow.com/a/26366344/1284996
the relevant passage:
optionals swift specific feature, not available in obj-c. optional class instances work because nil optional can mapped nil value, value types (int, floats, etc.) not reference types, hence variable of types don't store reference, value itself.
Comments
Post a Comment