2015-01-09 26 views

回答

13

你是在说:

if let ip = indexPath { 

斯威夫特说:“只要说let ip = indexPath,或直接使用indexPath直接。不需要if(或花括号); “

原因可能是当你使用的教程设计时,indexPath是可选的,需要解包。但现在它不是可选的。随时更改API

+0

如果您不明白可选是什么,或者为什么可能需要解开,请参阅我的新教程:http://www.apeth.com/swiftBook/ch03。 html#_optional对于“if let”展开方式:http://www.apeth.com/swiftBook/ch05.html#_if_construct但是你不需要知道_this_的情况,因为事实证明'indexPath '_不是可选的。 – matt 2015-01-09 19:55:14

+0

thanks @matt!我会检查你的教程 – suisied 2015-01-09 20:56:28

相关问题