I am trying to get "readerSession" from an associative array and put it into a variable. This is what I've tried.
Code
println(thevalue)
Returned
{
readerSession = 41;
tax = 7;
tax2 = 6;
taxName = GST;
taxName2 = PST;
}
So readerSession is equal to 41, now lets see if I can get ahold of it.
Code
println(thevalue["readerSession"])
Returned Optional(41)
Ok great, exactly what I want, now I'll try to put it into a variable.
Code
var readerSession = thevalue["readerSession"] as? String ?? "0"
println("READER SESSION \(readerSession) ")
Returned READER SESSION 0
Why is it "0"??? It should be "41"