I created a file in my ios app using below swift code.
let localFileName = String("file.rtf")
let text = String(“file contents”)
if let dir = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first {
let fileURL = dir.appendingPathComponent(localFileName)
do {
try text.write(to: fileURL, atomically: false, encoding: .utf8)
}
catch {}
do {
let text2 = try String(contentsOf: fileURL, encoding: .utf8)
print("Read from file \(text2)")
}
catch {}
}
this code is working, returning true and contents of created file are being printed indicating that file is created successfully. Problem is that where to find that created file? Where is that file? Where to locate that file in iPhone without code?