Swift 2.2, Contains Method not working

℡╲_俬逩灬. 提交于 2019-12-01 20:36:04

OPTION 1

The reason is that your class is inheriting from NSObject, therefore, you must fulfill the NSObjectProtocol instead of Equatable:

override func isEqual(object: AnyObject?) -> Bool {
     if let object = object as? Generic {
         return self.genericCode == object.genericCode
     }
     return false
 }

OPTION 2

Inherit from Equatable instead of NSObject (you probably can't use this option, since you seem to need NSCoding)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!