There is no type or protocol named "ReformerProtocol" in .h, but .m works fine

I have a quick protocol:

import Foundation @objc protocol ReformerProtocol { func reformDataWithManager(apiManager: FSAPIClient) -> NSDictionary } 

In my Objective Cm, if I define a method like:

 - (NSDictionary *)fetchDataWithReformer:(id<ReformerProtocol>)reformer { } 

it works fine, but if I declare this method in a .h file:

 - (NSDictionary *)fetchDataWithReformer:(id<ReformerProtocol>)reformer; 

Error:

 No type or protocol named 'ReformerProtocol' 

Not sure why.

+5
source share
1 answer

Before using it, just redirect the protocol in the .h file.

 @protocol ReformerProtocol; 
+20
source

Source: https://habr.com/ru/post/1232157/


All Articles