【问题标题】:How to write this objective c syntax in to swift 2.0 syntax? [closed]如何将此目标 c 语法写入 swift 2.0 语法? [关闭]
【发布时间】:2015-10-23 16:44:46
【问题描述】:
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)];

【问题讨论】:

  • 我们是否也应该复制语法错误?

标签: swift generics swift2


【解决方案1】:
let arrayTemp = ["asd", "szdfasd", "dsfgfdf"]
let dict = ["temp_array" : arrayTemp]
let result = dict["temp_array"]!.last!

【讨论】:

  • 你忘记复制7个错误
  • 我不知道如何翻译它们 ;-)
猜你喜欢
  • 2014-08-29
  • 1970-01-01
  • 1970-01-01
  • 2014-07-26
  • 2023-03-11
  • 1970-01-01
  • 2011-02-23
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多