diff --git a/Sources/FoundationMacros/BundleMacro.swift b/Sources/FoundationMacros/BundleMacro.swift index e919fba1b..867938887 100644 --- a/Sources/FoundationMacros/BundleMacro.swift +++ b/Sources/FoundationMacros/BundleMacro.swift @@ -22,6 +22,8 @@ public struct BundleMacro: SwiftSyntaxMacros.ExpressionMacro, Sendable { return Bundle.module #elseif SWIFT_MODULE_RESOURCE_BUNDLE_UNAVAILABLE #error("No resource bundle is available for this module. If resources are included elsewhere, specify the bundle manually.") + #elseif SWIFT_BUNDLE_LOOKUP_HELPER_AVAILABLE + return Bundle(for: __BundleLookupHelper.self) #else return Bundle(_dsoHandle: #dsohandle) ?? .main #endif diff --git a/Tests/FoundationMacrosTests/BundleMacroTests.swift b/Tests/FoundationMacrosTests/BundleMacroTests.swift index b9c1add51..ea3a51777 100644 --- a/Tests/FoundationMacrosTests/BundleMacroTests.swift +++ b/Tests/FoundationMacrosTests/BundleMacroTests.swift @@ -28,6 +28,8 @@ private struct BundleMacroTests { return Bundle.module #elseif SWIFT_MODULE_RESOURCE_BUNDLE_UNAVAILABLE #error("No resource bundle is available for this module. If resources are included elsewhere, specify the bundle manually.") + #elseif SWIFT_BUNDLE_LOOKUP_HELPER_AVAILABLE + return Bundle(for: __BundleLookupHelper.self) #else return Bundle(_dsoHandle: #dsohandle) ?? .main #endif @@ -48,6 +50,8 @@ private struct BundleMacroTests { return Bundle.module #elseif SWIFT_MODULE_RESOURCE_BUNDLE_UNAVAILABLE #error("No resource bundle is available for this module. If resources are included elsewhere, specify the bundle manually.") + #elseif SWIFT_BUNDLE_LOOKUP_HELPER_AVAILABLE + return Bundle(for: __BundleLookupHelper.self) #else return Bundle(_dsoHandle: #dsohandle) ?? .main #endif