what's the error: cannot link directly with 'SwiftUICore' because product being built is not an allowed client of it

Asked on 07/31/2024

1 search

The error "cannot link directly with 'SwiftUICore' because product being built is not an allowed client of it" typically occurs when there is an attempt to use a module or framework that is not intended to be directly accessed by your project. This can happen due to several reasons, such as:

  1. Module Access Restrictions: The module SwiftUICore might be restricted to certain clients or products, and your project is not one of them. This is often controlled by the module's access control settings.

  2. Incorrect Module Import: You might be trying to import a module that is not meant to be imported directly. Instead, you should use a higher-level module that internally uses SwiftUICore.

  3. Build Configuration Issues: There might be a misconfiguration in your build settings that is causing this issue. Ensuring that your project is correctly set up to use the necessary modules can help resolve this.

To address this error, you can try the following steps:

  • Check Module Documentation: Review the documentation for SwiftUICore to understand its intended usage and any access restrictions.
  • Use the Correct Module: Ensure that you are importing the correct module that is intended for your use case.
  • Review Build Settings: Verify your build settings to ensure that your project is configured correctly to use the necessary modules.

For more detailed guidance on handling module dependencies and build configurations, you might find the session Demystify explicitly built modules helpful. This session covers how modules are built and managed in Xcode, which could provide insights into resolving such issues.