Click here to Skip to main content
15,740,620 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am searching a key in an Array of dictionary like this.

I am getting the correct value for result. But my problem is I want to convert this result in to Int value. I tried several ways but didnt help.

This is one way I tried,, but this number checking condition doesn't get true.

How can I do this? Please help me. Thanks

What I have tried:

if let result = self.lasrIDArray.flatMap({$0["\(self.selectedTitle)"]}).first  {
                print("-------RESULT------\(result)") //->title of the other
                if let number=result as? NSNumber
                     let tag=number.integerValue
                     let currentScroll=self.view.viewWithTag(Int(api.selectedCatID)!) as! UIScrollView
                     let lastImgVw=currentScroll.viewWithTag(tag) as! UIImageView
                     print("-------LASTIMG ORIGIN------\(lastImgVw.frame.origin.y)")
Updated 13-Jul-16 22:02pm
Surya_Narayan 13-Sep-16 8:29am    
use typeconversion to conver result value to Int Datatype .
the replace NSNumber to NSInteger ..
I guess it will work

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900