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
Problem solved.
By simply adding .intValue
.
var Rating = self.currentPerson.Rating
let c = Rating.intValue - 1
Cred @luk2302
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.