Get current user's home directory
NSHomeDirectory
: “Returns the path to the current user’s home directory.”
Example:
NSLog(@"Current user’s home directory is %@", NSHomeDirectory());
Since macOS 10.12 you can also use FileManager.default.homeDirectoryForCurrentUser
, see the documentation.