Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8703747
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T02:56:14+00:00 2026-06-13T02:56:14+00:00

I have custom UIView class GestureView. I have a forward declaration for this class

  • 0

I have custom UIView class GestureView. I have a forward declaration for this class and it’s delegate below. I have imported GestureView.h in .m file. This works fine but iOS gives warning message saying “Cannot find protocol definition for GestureViewDelegate”. If I remove forward declaration it gives same warning message as error. I don’t want to import GestureView.h from ContainerViewController.h as I usually imports stuffs in .m file. Could someone please explain what’s wrong in following class structure?

ContainerViewController.h

#import <UIKit/UIKit.h>

@class DividerView;
@class GestureView;
@protocol GestureViewDelegate;

@interface ContainerViewController : UIViewController<GestureViewDelegate>
   @property (strong, nonatomic) IBOutlet GestureView *topContentView;
@end

GestureView.h

#import <UIKit/UIKit.h>

@protocol GestureViewDelegate;

@interface GestureView : UIView
    - (void)initialiseGestures:(id)delegate;
@end

@protocol GestureViewDelegate <NSObject>
@required
- (void)GestureView:(GestureView*)view handleSignleTap:(UITapGestureRecognizer*)recognizer;
@end
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T02:56:15+00:00Added an answer on June 13, 2026 at 2:56 am

    I like that you’re trying to avoid imports in header files: very good practice. However, to fix your bug you can just make your code even better! In my opinion it’s not really necessary that your ContainerViewController class outwardly declares that it supports GestureViewDelegate protocol, so you should move this into your implementation file. Like so:

    GestureView.h

    #import <UIKit/UIKit.h>
    
    
    @protocol GestureViewDelegate;
    
    @interface GestureView : UIView
    
    - (void)initialiseGestures:(id <GestureViewDelegate>)delegate;
    
    @end
    
    
    @protocol GestureViewDelegate <NSObject>
    @required
    
    - (void)gestureView:(GestureView *)view handleSingleTap:(UITapGestureRecognizer *)recognizer;
    
    @end
    

    ContainerViewController.h

    #import <UIKit/UIKit.h>
    
    
    @class GestureView;
    
    @interface CollectionViewController : UIViewController
    
    // this property is declared as readonly because external classes don't need to modify the value (I guessed seen as it was an IBOutlet)
    @property (strong, nonatomic, readonly) GestureView *topContentView;
    
    @end
    

    ContainerViewController.m

    #import "ContainerViewController.h"
    #import "GestureView.h"
    
    
    // this private interface declares that GestureViewDelegate is supported
    @interface CollectionViewController () <GestureViewDelegate>
    
    // the view is redeclared in the implementation file as readwrite and IBOutlet
    @property (strong, nonatomic) IBOutlet GestureView *topContentView;
    
    @end
    
    
    @implementation ContainerViewController
    
    // your implementation code goes here
    
    @end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a custom UIView subclass without a corresponding UIViewController. I use this class
I have a UIView custom class and the object created by this class has
I have a UIView class that contains a custom UISlider . When this UIView
I have one ViewController, in this i have added one Custom UIView named as
I have a custom UIView class. Inside that view, there is an image view.
I have a custom UIView class, and in the - (void)drawRect:(CGRect)rect I want to
I have a custom UIView. So myView class extend UIView. In initWithFrame:(CGRect)frame method I
I have a UIViewController Class which holds 2 custom UIView classes which are: ItemView
I have a custom UIWindow class that has an IBOutlet @interface MyWindow IBOutlet UIView
i have a custom UIView class,and i have linked my view in IB with

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.