1

In a swift class, I have defined two closure properies like so:

var confirmationHandler: ((address: Address, refinedCoordinate: CLLocationCoordinate2D?) -> Void)?

var anotherHandler: ((address: Address, refinedCoordinate: CLLocationCoordinate2D) -> Void)?

When I try to set the former from Objective C code, I get the following error:

Property 'confirmationHandler' not found on object of type...

I have no trouble setting the latter. Why is this?

Sean Danzeiser
  • 9,141
  • 12
  • 52
  • 90

1 Answers1

0

Got this answer off of the post here: https://stackoverflow.com/a/26366344/1284996

The relevant passage:

Optionals are a swift specific feature, not available in obj-c. Optional class instances work because a nil optional can be mapped to a nil value, but value types (int, floats, etc.) are not reference types, hence variable of those types don't store a reference, but the value itself.

Community
  • 1
  • 1
Sean Danzeiser
  • 9,141
  • 12
  • 52
  • 90