Swift playground on iPadOS seems not support file operations
I am developing an app on the iPadOS’s Swift playground. And I found that by using FileManager, I can not create/edit any file even within bundle.
my code:
func createNewFile(){
let filePath = Bundle.main.bundlePath
let fm = FileManager()
var success = fm.createFile(atPath: filePath+"/de.txt", contents: "tt".data(using: String.Encoding.utf8), attributes: nil)
print(success)
}
and the result is always false.
is it because the Swift playground on iPadOS currently do not support file operations? It can read a file from resources, but can not write.
According to what I know, it should be possible to make Swift playground on iPadOS to do file operation, because the Python interpreter on iPadOS (such as Pyto), and also C++ complier on iPadOS, etc, all can do file operations within in its app directory. I tried, no problem. It can read, write, delete files.
Best regards
Iven Dong
iPad Air, iPadOS 16