Uploaded image for project: 'Swift'
  1. Swift
  2. SR-10707

Issues importing Obj-C module in Obj-C Target

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Medium
    • Resolution: Done
    • Component/s: Package Manager
    • Labels:
      None
    • Environment:

      Apple Swift Package Manager - Swift 5.0.0 (swiftpm-14490.62.2)
      macOS Mojave 10.14.5
      Xcode Version 10.2.1 (10E1001)
       

      Description

      (First reported on the forums)

      With two C based targets where one has a dependency on the other, I would expect to be able to use `@import <ModuleNameFromTarget>;` to import the generated module in the C (Objective-C in this case) code. I'm able to successfully import modules from both targets in a Swift based target, but not in a C based target. The only way to successfully import headers from the other target is to  use the header name directly as a file import.

      There are two errors that occur:

      1. Running swift build or swift run will result in a fatal error: module 'Foo' not found.
      2. If you generate an Xcode project, C based modules are disabled in the generated project so it fails right away.

      I created a simple repro project on GitHub to demonstrate this with annotations on the problematic lines.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              ryanwilson Ryan Wilson
            • Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: