SPM inside XCFramework

I want to use a swift package manager inside a xcframework which certainly will be used inside ios appliation. I am able to build my framework which is having package embedded. But when I am trying to use that framework by importing it in my app, I am facing issue related to that package module showing Missing required module 'XYZ' where 'XYZ' is the package used in framework.
Is it possible to use spm in any framework? Or Is there any search path i need to set inside the framework or application? Please help me regarding this.

This is somewhat of an experimental feature, but you can import that SwiftPM package using @_implementationOnly import XYZ in order to hide the import from clients of your framework. That should alleviate these issues. The compiler will prevent you from using any types inside XYZ in the public interface for your framework, since clients won't be able to see into XYZ.


Hi @harlanhaskins ,Thanks for your quick reply. I am able to achieve same. You are absolutely correct , the key is to set @_implementationOnly import XYZ and set the path of .modulemap file in import paths in swift compiler search paths.

Terms of Service

Privacy Policy

Cookie Policy