如何将此目标c语法写入swift 2.0语法?

时间:2015-10-23 16:44:46

标签: swift generics swift2

NSArray *arrayTemp = [NSArray alloc] initWithObjects:@"asd", @"szdfasd", @"dsfgfdf", nil];

NSDictionary *dict = [NSDictionary alloc] initWithObjectsAndKeys:arrayTemp, @"temp_array", nil];

NSString result =  [((NSArray ) [dict objectForKey:@"temp_array"]) objectAtIndex:(arrayTemp.count -1)];

1 个答案:

答案 0 :(得分:1)

let arrayTemp = ["asd", "szdfasd", "dsfgfdf"]
let dict = ["temp_array" : arrayTemp]
let result = dict["temp_array"]!.last!