ios - NSDictionary vs [String:AnyObject] in Swift -
i updated external swift library, , 1 of methods has changed face from:
public convenience method(data:nsdictionary?) { ... }
to:
public convenience method(data:[string: anyobject]?) { ... }
what mean?
initially, old,
@{@"optiona":@yes}
passeddata
argument. new need pass 2 items. thinking write@{@"optiona":@yes,@"optionb":@no}
, correct?
it means parameter swift dictionary , no objective-c nsdictionary anymore.
to pass data, use square brackets instead of curly brackets , remove "@" (in swift)
["optiona":true, "optionb": false]
if calling method objective-c, method parameter should exposed nsdictionary , right @{@"optiona":@yes,"optionb":@no}
missed @-sign before optionb
Comments
Post a Comment