---
title: NSHomeDirectory()
framework: foundation
role: symbol
role_heading: Function
path: foundation/nshomedirectory()
---

# NSHomeDirectory()

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

## Declaration

```swift
func NSHomeDirectory() -> String
```

## Return Value

Return Value The path to the current home directory.

## Discussion

Discussion In iOS, the home directory is the application’s sandbox directory. In macOS, it’s the application’s sandbox directory, or the current user’s home directory if the application isn’t in a sandbox.

## See Also

### Accessing user directories

- [homeDirectoryForCurrentUser](foundation/filemanager/homedirectoryforcurrentuser.md)
- [NSUserName()](foundation/nsusername().md)
- [NSFullUserName()](foundation/nsfullusername().md)
- [homeDirectory(forUser:)](foundation/filemanager/homedirectory(foruser:).md)
- [NSHomeDirectoryForUser(_:)](foundation/nshomedirectoryforuser(_:).md)
- [temporaryDirectory](foundation/filemanager/temporarydirectory.md)
- [NSTemporaryDirectory()](foundation/nstemporarydirectory().md)
