---
title: "setPath(_:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nsbrowser/setpath(_:)"
---

# setPath(_:)

Sets the path to be displayed by the browser.

## Declaration

```swift
func setPath(_ path: String) -> Bool
```

## Parameters

- `path`: The path to display. If path is prefixed by the path separator, the path is absolute, containing the full path from the browser’s first column. Otherwise, the path is relative, extending the browser’s current path starting at the last column.

## Return Value

Return Value true if the given path is valid; otherwise, false.

## Discussion

Discussion While parsing path, the browser compares each component with the entries in the current column. If an exact match is found, the matching entry is selected, and the next component is compared to the next column’s entries. If no match is found for a component, the method exits and returns false; the final path is set to the valid portion of path. If each component of path specifies a valid branch or leaf in the browser’s hierarchy, the method returns true.

## See Also

### Managing the Path

- [path()](appkit/nsbrowser/path().md)
- [path(toColumn:)](appkit/nsbrowser/path(tocolumn:).md)
- [pathSeparator](appkit/nsbrowser/pathseparator.md)
