I searched a lot and couldn't find the answer. I just started using xcode and have a very very simple program named "Image Test".
---> It has a button, and a textField. I want to show my system home directory path in the textField. This is my code:
@IBOutlet weak var textField1: NSTextField!
@IBAction func Button1(_ sender: Any) {
do{
let home = try FileManager.default.homeDirectoryForCurrentUser
textField1.stringValue = home.path
}
catch{}
}
it works but the returned path is like: /Users/myname/Library/Containers/com.Image-Test/Data
I have tested this code before in Xcode Playground and it was correct. Its the same code but not throwing the right path.