From fd2989586b7037d268fa5a489fbb0eb0f3577c9d 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 c0e05f2..d455e00 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`