I have a problem when write text to file document. This my source code:
func getDocumentsDirectory() -> URL {
let paths = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask)
return paths[0]
}
let fileName = getDocumentsDirectory().appendingPathComponent("LogFile.txt")
do {
try KML.soapRequest.xml.write(to: fileName, atomically: true, encoding: String.Encoding.utf8)
} catch {
print("Failed save")
}
I want insert text to file "LogFile.txt", I am newbie in swift language.
Thanks for all the help.