---
title: "isWritableFile(atPath:)"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/filemanager/iswritablefile(atpath:)"
---

# isWritableFile(atPath:)

Returns a Boolean value that indicates whether the invoking object appears able to write to a specified file.

## Declaration

```swift
func isWritableFile(atPath path: String) -> Bool
```

## Parameters

- `path`: A file path.

## Return Value

Return Value true if the current process has write privileges for the file at path; otherwise false if the process does not have write privileges or the existence of the file could not be determined.

## Discussion

Discussion If the file at path is inaccessible to your app, perhaps because it does not have search privileges for one or more parent directories, this method returns false. This method traverses symbolic links in the path. This method also uses the real user ID and group ID, as opposed to the effective user and group IDs, to determine if the file is writable. note: Attempting to predicate behavior based on the current state of the file system or a particular file on the file system is not recommended. Doing so can cause odd behavior or race conditions. It’s far better to attempt an operation (such as loading a file or creating a directory), check for errors, and handle those errors gracefully than it is to try to figure out ahead of time whether the operation will succeed. For more information on file system race conditions, see Race Conditions and Secure File Operations in Secure Coding Guide.

## See Also

### Determining access to files

- [fileExists(atPath:)](foundation/filemanager/fileexists(atpath:).md)
- [fileExists(atPath:isDirectory:)](foundation/filemanager/fileexists(atpath:isdirectory:).md)
- [isReadableFile(atPath:)](foundation/filemanager/isreadablefile(atpath:).md)
- [isExecutableFile(atPath:)](foundation/filemanager/isexecutablefile(atpath:).md)
- [isDeletableFile(atPath:)](foundation/filemanager/isdeletablefile(atpath:).md)
