Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Swift : Redundant conformance of Viewcontroller to protocol UIGestureRecognizerDelegate

I want to add two frameworks SWRevealViewController and SLKTextViewController but I get this weird error.

I read about this error but it seems confusing.

Redundant conformance of Viewcontroller to protocol UIGestureRecognizerDelegate

class Viewcontroller: SLKTextViewController,SWRevealViewControllerDelegate,UIGestureRecognizerDelegate {

    // a lot of functions and code

}
like image 561
marrioa Avatar asked Sep 12 '15 15:09

marrioa


1 Answers

The reason for the error is that you try to conform to the UIGestureRecognizerDelegate two times. One time explictily be writing it in the beginning and the second time by extending SLKTextViewController which already conforms to it - the source code of SLKTextViewController consists of the following line:

NS_CLASS_AVAILABLE_IOS(7_0) @interface SLKTextViewController : UIViewController <UITextViewDelegate, UITableViewDelegate, UITableViewDataSource, UICollectionViewDelegate, UICollectionViewDataSource, UIGestureRecognizerDelegate, UIAlertViewDelegate>

which among other protocols already lists the UIGestureRecognizerDelegate!

Solution: remove the UIGestureRecognizerDelegate by changing your code to

class Viewcontroller : SLKTextViewController, SWRevealViewControllerDelegate {
like image 112
luk2302 Avatar answered Sep 28 '22 07:09

luk2302