简体   繁体   中英

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

}

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 {

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM