在 Xcode 7 中,我的 iOS 应用程序的资源应该放在哪里?

Where do I put resources for my iOS app in Xcode 7?

我正在构建一个 iOS 应用程序,我需要在其中读取文本文件。我应该把这个文件放在 Xcode 的什么地方才能正确读取它?

如果我答对了你的问题,

只需将文件拖放到 xcode 中即可:

例如你的文件名是 sample.txt 你可以简单地阅读它:

if let path = NSBundle.mainBundle().pathForResource("sample", ofType: "txt"){
    //reading
    do {
        let text = try NSString(contentsOfFile: path, encoding: NSUTF8StringEncoding)
        print(text)
    }
    catch {/* error handling here */}
}