Returns the path to either the user’s or application’s home directory, depending on the platform.


func NSHomeDirectory() -> String

Return Value

The path to the current home directory..


In iOS, the home directory is the application’s sandbox directory. In macOS, it is the application’s sandbox directory or the current user’s home directory (if the application is not in a sandbox)

For more information on file-system utilities, see Low-Level File Management Programming Topics.

See Also

File Path Functions

func NSFullUserName() -> String

Returns a string containing the full name of the current user.

func NSHomeDirectoryForUser(String?) -> String?

Returns the path to a given user’s home directory.

func NSOpenStepRootDirectory() -> String

Returns the root directory of the user’s system.

func NSTemporaryDirectory() -> String

Returns the path of the temporary directory for the current user.

func NSUserName() -> String

Returns the logon name of the current user.