I am searching a key in an Array
of Dictionarys
and I want to convert the result value into an Int
value. This is what I tried.
if let result = lasrIDArray.flatMap( {$0["\(self.selectedTitle)"]} ).first {
print(result)
if let number = result as? NSNumber {
let tag = number.integerValue
let currentScroll = view.viewWithTag(Int(api.selectedCatID)!) as! UIScrollView
let lastImgVw = currentScroll.viewWithTag(tag) as! UIImageView
print(lastImgVw.frame.origin.y)
}
}
But if let number = result as? NSNumber
doesn't work as expected. What is the correct way to convert this value?