We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d9d1148 commit 825c0dfCopy full SHA for 825c0df
Library/Core/FileResource.swift
@@ -20,6 +20,26 @@ public protocol FileResourceType {
20
var pathExtension: String { get }
21
}
22
23
+public extension FileResourceType {
24
+ /**
25
+ Returns the full pathname for this resource.
26
+
27
+ - returns: The full pathname for this resource or nil if the file could not be located.
28
+ */
29
+ func path() -> String? {
30
+ return bundle?.pathForResource(self)
31
+ }
32
33
34
+ Returns the file URL for this resource.
35
36
+ - returns: The file URL for this resource or nil if the file could not be located.
37
38
+ func url() -> NSURL? {
39
+ return bundle?.urlForResource(self)
40
41
+}
42
43
public struct FileResource: FileResourceType {
44
/// Bundle this file is in or nil for main bundle
45
public let bundle: NSBundle?
0 commit comments