---
title: "urls(for:in:)"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/filemanager/urls(for:in:)"
---

# urls(for:in:)

Returns an array of URLs for the specified common directory in the requested domains.

## Declaration

```swift
func urls(for directory: FileManager.SearchPathDirectory, in domainMask: FileManager.SearchPathDomainMask) -> [URL]
```

## Parameters

- `directory`: The search path directory. The supported values are described in doc://com.apple.foundation/documentation/Foundation/FileManager/SearchPathDirectory.
- `domainMask`: The file system domain to search. The value for this parameter is one or more of the constants described in doc://com.apple.foundation/documentation/Foundation/FileManager/SearchPathDomainMask.

## Mentioned in

Using the file system effectively

## Return Value

Return Value An array of NSURL objects identifying the requested directories. The directories are ordered according to the order of the domain mask constants, with items in the user domain first and items in the system domain last.

## Discussion

Discussion This method is intended to locate known and common directories in the system. For example, setting the directory to FileManager.SearchPathDirectory.applicationDirectory, will return the Applications directories in the requested domain. There are a number of common directories available in the FileManager.SearchPathDirectory, including: FileManager.SearchPathDirectory.desktopDirectory, FileManager.SearchPathDirectory.applicationSupportDirectory, and many more.

## See Also

### Locating system directories

- [url(for:in:appropriateFor:create:)](foundation/filemanager/url(for:in:appropriatefor:create:).md)
- [NSSearchPathForDirectoriesInDomains(_:_:_:)](foundation/nssearchpathfordirectoriesindomains(_:_:_:).md)
- [NSOpenStepRootDirectory()](foundation/nsopensteprootdirectory().md)
