I've got a class Email
:
import SwiftyJSON
class Email: NSObject {
required init?(JSON jsonObject: AnyObject) {
let emailJsonObject = JSON(jsonObject)
self.email = emailJsonObject["emailaddress"].stringValue
self.emailType = emailJsonObject["emailtype"].stringValue
}
var email: String
var emailType: String
}
func == (lhs: Email, rhs: Email) -> Bool {
return lhs.email == rhs.email && lhs.emailType == rhs.emailType
}
Now if I have two Arrays
:
let newEmails = emailsJsonObjects.map({ return Email(JSON: $0)! }).sort({ $0.0.email < $0.1.email })
let currentEmails = (self.emails as! [Email]).sort({ $0.0.email < $0.1.email })
Both have one element, and they have the same email
and emailType
, here's what I've got by comparing them:
(lldb) po newEmails.count
1
(lldb) po currentEmails.count
1
(lldb) po newEmails == currentEmails
false
(lldb) po newEmails[0] == currentEmails[0]
true
Am I missing something? Are the comparisons different?