Swift 2.2 option breaks / options reversal

Swift 2.2 broke almost all of my code. Even this simple label-assigning line no longer works:

cell.categoryName.text = peopleArray![indexPath.row]["Name"] as? String

The error says “ Downcast from” String ?! "to 'String' only expands options, did you want to use '!!'? "

What changes do I need to make now.

EDIT

Additional issues:

if (dict["data"]!["DataDetails"] as! NSArray).count == 0 {
}

In this regard, I get a segmentation error, and the error shows this: warning: other than 'String ?!' for an unrelated type, "NSArray" always fails

UPDATE:

NSDictionaries, NSArrays , , , . Obj-C , . .

+4
1

, objective-c NS...

,

let dic:NSDictionary? = ["a":"a"]

let str:NSString? = dic!["a"] as? NSString

let dic2:Dictionary? = ["b":"b"]

let str2:String? = dic2!["b"] //dont need to do any casting, already optional

print(str)
print(str2)

Optional(a)
Optional("b")

, /, /

0

All Articles