与NavigationControllerDelegate的冗余一致性

时间:2017-07-01 00:56:09

标签: swift xcode uinavigationcontroller

我有一个错误说Redundant Conformance to Protocol UINavigationControllerDelegate

所以这是我单独的代码片段。

class DelegateProfileViewController: FormViewController, MFMailComposeViewControllerDelegate, UINavigationControllerDelegate  {


class ChatViewController: JSQMessagesViewController, UIActionSheetDelegate, UIImagePickerControllerDelegate, 
 UINavigationControllerDelegate {


class EditSubGroupViewController: FormViewController, SelectUsersFromSubGroupDelegate, SelectSingleFromSubGroupDelegate, UIImagePickerControllerDelegate, UINavigationControllerDelegate {



extension CreateEngagementViewController: UIImagePickerControllerDelegate, UINavigationControllerDelegate {


class FeedViewController: UITableViewController, UIImagePickerControllerDelegate, UINavigationControllerDelegate, DZNEmptyDataSetSource, DZNEmptyDataSetDelegate, UITextFieldDelegate {

你明白了。这些错误中的每一个都出现了BLANK对协议UINavigationControllerDelegate的冗余一致性。

如果有人告诉我为什么这些错误会影响我的项目,我会很高兴。感谢

1 个答案:

答案 0 :(得分:1)

如果子类声明与已从超类继承的协议的一致性,您将收到该错误消息

举个例子:如果在你的情况下,FormViewController已经符合UINavigationControllerDelegate

class FormViewController: UINavigationControllerDelegate

然后没有必要通过这样做再次符合它: -

class DelegateProfileViewController: FormViewController, MFMailComposeViewControllerDelegate, UINavigationControllerDelegate

相反应该改为: -

class DelegateProfileViewController: FormViewController, MFMailComposeViewControllerDelegate

这将消除您的冗余一致性。希望你能了解我在说什么。