Using Swift Package resources with an Objective-C target

I have a library that is written almost entirely in Objective-C and that library need serval resources (Core Data models), according to SE-0271:

SwiftPM will generate an internal static extension on Bundle for each module it compiles:

extension Bundle {
    /// The bundle associated with the current Swift module.
    static let module: Bundle = { ... }()

How can I access the module bundle from Objective-C?

Thanks in advance.

From that same proposal:

For Objective-C, the build system will add a preprocessor define called SWIFTPM_MODULE_BUNDLE which can be used to access the bundle from any .m file.

:man_with_probing_cane: probably I need new glasses.

Terms of Service

Privacy Policy

Cookie Policy