let expdate = NSUserDefaults.standardUserDefaults().objectForKey("expiration") as! NSDate
let calendar = NSCalendar.currentCalendar()
let components = calendar.components([.Day , .Month , .Year], fromDate: expdate)
var theyear = components.year
var themonth = components.month
stripCard.expMonth = themonth
stripCard.expYear = theyear
On the last 2 lines I'm getting an error: "Cannot assign value of type 'Int' to type "Uint'. I've tried casting and it still won't work
You mentioned that you tried casting, I assume you mean something like:
stripCard.expMonth = themonth as! UInt
But casting won't work because they are completely different types. Instead, try converting using UInt's initializer that takes an Int, like this:
stripCard.expMonth = UInt(themonth)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With