Reputation: 1623
var Rating = self.currentPerson.Rating
let c = Rating - 1
Im trying to get the value x
of self.currentPerson.Rating
and subtract 1 from value x
. But Im only getting the error bellow.
Error : Binary operator '-' cannot be applied to operands of type 'NSNumber' and 'Int'
Question : How do I solve this?
Thanks
Upvotes: 4
Views: 3449
Reputation: 1623
Problem solved.
By simply adding .intValue
.
var Rating = self.currentPerson.Rating
let c = Rating.intValue - 1
Cred @luk2302
Upvotes: 6