简体   繁体   English

Swift:Viewcontroller与协议UIGestureRecognizerDelegate的冗余一致性

[英]Swift : Redundant conformance of Viewcontroller to protocol UIGestureRecognizerDelegate

I want to add two frameworks SWRevealViewController and SLKTextViewController but I get this weird error. 我想添加两个框架SWRevealViewControllerSLKTextViewController但我得到这个奇怪的错误。

I read about this error but it seems confusing. 我读到了这个错误,但似乎令人困惑。

Redundant conformance of Viewcontroller to protocol UIGestureRecognizerDelegate Viewcontroller与协议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. 出错的原因是您尝试两次符合UIGestureRecognizerDelegate 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: 一个时间explictily在一开始,并通过延伸的第二时间写它SLKTextViewController其中已经符合它- 的源代码SLKTextViewController由下面的行的:

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

which among other protocols already lists the UIGestureRecognizerDelegate ! 其他协议中已经列出了UIGestureRecognizerDelegate

Solution : remove the UIGestureRecognizerDelegate by changing your code to 解决方案 :通过将代码更改为删除UIGestureRecognizerDelegate

class Viewcontroller : SLKTextViewController, SWRevealViewControllerDelegate {

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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