I'v been trying to write a document directory file but I can't find the file anywhere. ( Terminal comand: find . -name "blw*"). Part of the ContentView.swift looks like this.
func writeFile() { let file = "blw.txt" let text = "hakemisto" let documentDirectory = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first! print("documentDir: (documentDirectory)") if let dir = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first { let fileURL = dir.appendingPathComponent(file) do { try text.write(to: fileURL, atomically: false, encoding: .utf8) } catch { } } I don't understand what's wrong. That print does not print anything so I guess that whole if section is ignored.
MacOS 12.0.1 XCode 13.1