快速更新后,Hashable发出警告

时间:2019-04-02 22:31:42

标签: swift

class Inbox: Hashable {

    var hashValue: Int = 0

    static func == (lhs: Inbox, rhs: Inbox) -> Bool {

        return lhs.userID == rhs.userID
    }

    var user = "name"
    var pmsg = "label"
    var match = ""
    var resim = "photo"
    var userID = ""
    var distance = ""
    var updated = ""
    var isAttendingNow = ""
    var isAttendingNowText = ""


    init(user : String, pmsg: String, match: String, resim: String, userID : String, distance: String, updated: String, isAttendingNow: String, isAttendingNowText: String) {

      self.user = user
      self.pmsg = pmsg
        self.match = match
        self.resim = resim
        self.userID = userID
        self.distance = distance
        self.updated = updated
        self.isAttendingNow = isAttendingNow
        self.isAttendingNowText = isAttendingNowText

    }
}

我有'Hashable.hashValue' is deprecated as a protocol requirement; conform type 'Inbox' to 'Hashable' by implementing 'hash(into:)' instead

如何消除此警告?

0 个答案:

没有答案