How to get user home directory path (Users/"user name") without knowing the username in Swift3

You can use FileManager property homeDirectoryForCurrentUser

let homeDirURL = FileManager.default.homeDirectoryForCurrentUser

If you need it to work with earlier OS versions than 10.12 you can use

let homeDirURL = URL(fileURLWithPath: NSHomeDirectory())

print(homeDirURL.path)

There should be an easier way but -- at worst -- this should work:

let filePath = NSString(string: "~").expandingTildeInPath