Bundle
class Bundle : NSObject
-
Returns the full pathname for the resource identified by the specified file.
The method first looks for a matching resource file in the non-localized resource directory of the specified bundle. If a matching resource file is not found, it then looks in the top level of an available language-specific .lproj folder. (The search order for the language-specific folders corresponds to the user’s preferences.) It does not recurse through other subfolders at any of these locations. For more details on how localized resources are found, read The Bundle Search Pattern in Bundle Programming Guide.
Declaration
Swift
func path(for file: File) -> String?
Parameters
file
An object adopting the
File
protocol.Return Value
The full pathname for the resource file or
nil
if the file could not be located. -
Returns the file URL for the resource identified by the specified file.
If
extension
is an empty string ornil
, the returned pathname is the first one encountered where the file name exactly matches name. For details on how localized resources are found, read read The Bundle Search Pattern in Bundle Programming Guide.Declaration
Swift
func url(for file: File) -> URL?
Parameters
file
An object adopting the
File
protocol.Return Value
The file URL for the resource file or
nil
if the file could not be located.