【发布时间】:2015-09-25 01:43:14
【问题描述】:
以下代码给出了错误
“do-while”循环中的预期“while”
if let path = NSBundle.mainBundle().pathForResource("Chapters", ofType: "txt"){
do {
let stringFromFile = try String(contentsOfFile:path, encoding: NSUTF8StringEncoding)
var chapters: [String] = stringFromFile.componentsSeparatedByString("@")
chapters.removeAtIndex(0)
} catch {
print((error))
}
}
它之前工作正常,但现在它给了我一个错误。有谁知道为什么?
【问题讨论】:
标签: xcode swift do-while xcode7 do-loops