I have a protocol in swift:
import Foundation
@objc protocol ReformerProtocol {
func reformDataWithManager(apiManager: FSAPIClient) -> NSDictionary
}
In my Objective C .m if i define a method like:
- (NSDictionary *)fetchDataWithReformer:(id<ReformerProtocol>)reformer {
}
it works fine, but if i declare this method in .h file:
- (NSDictionary *)fetchDataWithReformer:(id<ReformerProtocol>)reformer;
The error is:
No type or protocol named 'ReformerProtocol'
Not sure the reason.
You should simply forward-declare the protocol in the .h file before using it.
@protocol ReformerProtocol;
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