Returns a Boolean value that indicates whether a file or directory exists at a specified path.
- iOS 2.0+
- macOS 10.0+
- Mac Catalyst 13.0+
- tvOS 9.0+
- watchOS 2.0+
The path of a file or directory. If
pathbegins with a tilde (
~), it must first be expanded with
expanding, or this method will return
Tilde In Path
Upon return, contains
pathis a directory or if the final path element is a symbolic link that points to a directory; otherwise, contains
pathdoesn’t exist, this value is undefined upon return. Pass
NULLif you do not need this information.
true if a file at the specified path exists, or
false if the file’s does not exist or its existence could not be determined.
If the file at
path is inaccessible to your app, perhaps because one or more parent directories are inaccessible, this method returns
false. If the final element in
path specifies a symbolic link, this method traverses the link and returns
false based on the existence of the file at the link destination.
If you need to further determine whether
path is a package, use the
is method of
Listing 1 gets an array that identifies the fonts in the user's fonts directory: