paths(forResourcesOfType:inDirectory:)
Returns an array containing the pathnames for all bundle resources having the specified extension and residing in the bundle directory at the specified path.
Declaration
class func paths(forResourcesOfType ext: String?, inDirectory bundlePath: String) -> [String]Parameters
- ext:
The filename extension of the files to locate.
If you specify an empty string or
nil, the extension is assumed not to exist and all of the files inbundlePathare returned. - bundlePath:
The top-level directory of a bundle. This must represent a valid path.
Return Value
An array containing the full pathnames for all bundle resources with the specified extension. This method returns an empty array if no matching resource files are found. It also returns an empty array if the bundle specified by the bundlePath parameter does not exist or is not a readable directory.
Discussion
This method provides a means for dynamically discovering multiple bundle resources of the same type. For details on how localized resources are found, read The Bundle Search Pattern in Bundle Programming Guide.
See Also
Related Documentation
Finding Resource Files
url(forResource:withExtension:subdirectory:)url(forResource:withExtension:)urls(forResourcesWithExtension:subdirectory:)url(forResource:withExtension:subdirectory:localization:)urls(forResourcesWithExtension:subdirectory:localization:)url(forResource:withExtension:subdirectory:in:)urls(forResourcesWithExtension:subdirectory:in:)path(forResource:ofType:)path(forResource:ofType:inDirectory:)path(forResource:ofType:inDirectory:forLocalization:)paths(forResourcesOfType:inDirectory:)paths(forResourcesOfType:inDirectory:forLocalization:)path(forResource:ofType:inDirectory:)