I have the following protocol definition:
@objc protocol PersonDataStore {
func findPersonWithId(remoteId: String, completionBlock: ((Person) -> Void)!)
// ...
}
The error I get is that the second parameter cannot be represented in Objective-C. I researched the blocks/closures topic but I have a hard time getting my head around it since it is so conceptually different.
Is this just a matter of syntax or is it really not possible to define an Objective-C protocol with a closure in Swift?
I believe your problem is that your class Person is not a subclass of NSObject. Add @objc to the declaration of your Person class or make it a subclass of NSObject and your protocol definition should work.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With