Skip to content

Library products with dynamic types cause linking errors for unit tests #29

@mlink

Description

@mlink

For years there has been an issue where library products with .dynamic types have caused linking problems when building unit test targets in Xcode.

Apple documentation recommends always not defining the library type so that it is always automatic.

A library’s product can be either statically or dynamically linked. It’s recommended that you don’t explicitly declare the type of library, so Swift Package Manager can choose between static or dynamic linking based on the preference of the package’s consumer.

This issue is apparent if using Xcode 15.4 or earlier. It seems that the Xcode 16.0 or 16.1 has fixed these issues. Although when using Xcode 16 there is still an extra step involved of adding a library explicitly to the app target. If a change is made to remove the .dynamic type from a library product than that extra step is unnecessary.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions