1

Is there any way to silence Xcode compiler warnings because of unknown types like with @class? I defined a type in a single .h file that can be reused throughout the app:

#ifndef Apsiape_InterfaceDefinitions_h
#define Apsiape_InterfaceDefinitions_h

#define COLOR_ALERT_RED [UIColor colorWithRed:1 green:0.3 blue:0.3 alpha:1]
...

typedef enum  {
    BYEdgeTypeNone = 0,
    BYEdgeTypeTop,
    BYEdgeTypeLeft,
    BYEdgeTypeBottom,
    BYEdgeTypeRight
} BYEdgeType;

#endif

And one of my classes uses the BYEdgeType type for a custom protocol in the .h file:

#import <UIKit/UIKit.h>

@protocol BYPullScrollViewDelegate <NSObject>

- (void)pullScrollView:(UIScrollView*)pullScrollView didScrollToPage:(NSInteger)page;
- (void)pullScrollView:(UIScrollView*)pullScrollView didDetectPullingAtEdge:(BYEdgeType)edge;

@end

I want my InterfaceDefinitions.h file to be in the .m file of my class, but if I don't import it in the .m of the class Xcode (of course) complains that it "Expected a type" (BYEdgeType). How can I silence this warning @class-style?

Thanks in advance

Dario
  • 1,315
  • 1
  • 11
  • 24

1 Answers1

0

Is the protocol defined in a header (.h) file? If so, to use enums and #defines in the .h file, you'll have to import the header with those definitions in that .h file.

mipadi
  • 398,885
  • 90
  • 523
  • 479