From e02b4865df205acb9de577fe20cb5a85875749da Mon Sep 17 00:00:00 2001 From: roydbt Date: Fri, 5 Apr 2024 16:02:35 +0300 Subject: [PATCH] Added a new extension method for Bundle --- Sources/Extensions.swift | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Sources/Extensions.swift b/Sources/Extensions.swift index 27f84b8..ee96a96 100644 --- a/Sources/Extensions.swift +++ b/Sources/Extensions.swift @@ -9,6 +9,13 @@ public extension Bundle { return str.flatMap(Path.init) } + /// Returns the path for requested resource in this bundle. + func path2(forResource: String, ofType: String?, inDirectory: String?) -> Path? { + let f: (String?, String?, String?) -> String? = path(forResource:ofType:inDirectory:) + let str = f(forResource, ofType, inDirectory) + return str.flatMap(Path.init) + } + /** Returns the path for the shared-frameworks directory in this bundle. - Note: This is typically `ShareFrameworks`