Wie konvertiere ich AnyObject-Typ in Int in Swift

Ich suche einen Schlüssel in einemArray vonDictionarys und ich möchte den Ergebniswert in ein @ konvertierInt Wert. Das habe ich versucht.

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)
    }
}

Aberif let number = result as? NSNumber funktioniert nicht wie erwartet. Wie kann dieser Wert richtig konvertiert werden?

Antworten auf die Frage(6)

Ihre Antwort auf die Frage