我想在ios应用中阅读文本文件。 test1 文件夹包含 one.txt 文件。当我删除此“ inDirectory:”test1“”时,我的代码正常运行。但我想提一下文件夹名称。怎么做?
if let path = Bundle.main.path(forResource: "one", ofType: "txt" ,
inDirectory:"test1" )
{
text2 = try! String(contentsOfFile: path, encoding:String.Encoding.utf8)
}
else
{
print("file not found")
}