Initializer
init(fileURLWithPath:isDirectory:)
iOS 8.0+Deprecated
iPadOS 8.0+Deprecated
Mac Catalyst 8.0+Deprecated
macOS 10.10+Deprecated
tvOS 9.0+Deprecated
visionOS 1.0+Deprecated
watchOS 2.0+Deprecated
Deprecated
Use init(filePath:directoryHint:relativeTo:) instead
Creates a file URL that references the local file or directory at the given path.
init(fileURLWithPath path: String, isDirectory: Bool)
Parameters
pathThe location in the file system.
isDirectoryA Boolean value that indicates whether the path references a directory.
Discussion
If an empty string is used for the path, the system interprets it as “.”.
Note
This function avoids an extra file system access to check if the file URL is a directory. You should use it if you know the answer already.