Unable to import multiple targets from external dependency

Hi,

I'm creating my own swift package which has external dependency which contains multiple targets however i can't add all those targets as dependencies in my package, by default OHHTTPStubs i can add and import, but i can't add OHHTTPStubsSwift and import

Spelled in full, it would be this:

dependencies: [
  .target(name: "MyLibrary"),
  .product(name: "OHHTTPStubs", package: "OHHTTPStubs"),
  .product(name: "OHHTTPStubsSwift", package: "OHHTTPStubs")
]

However, the first two entries are allowed to be abbreviated—MyLibrary because it is from the same package, and OHHTTPSStubs because it shares its name with the package it comes from.

(P.S. It’s not actually targets you are depending on, but products. They may not correspond to the directory structure displayed by Xcode, or even to the import statements you’ll use in the source. What the dependency declarations are referring to are the products declared in the other package’s manifest. In the case of the OHHTTPSStubs package, they are listed here.)

@SDGGiesbrecht Thank you so much it's much clear now and error is resolved :slight_smile:

BTW i'm very much new to this SPM and i have some more minor issues in my xcode

  1. I have some 3rd party dependencies which has min deployment target is 8.0 and my target is 12.0, however i'm getting warning like this

The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.0.99.

  1. I tried to set default localization into "Base" i don't think this is valid language code and i'm getting warning like this, i have Base.lproj folder is there any way to set "Base" as default localization?

: resource 'Localizable.strings' in target 'ECKit' is missing the default localization 'Base'; the default localization is used as a fallback when no other localization matches

let package = Package(
name: "ECKit",
defaultLocalization: "Base" .....)

I’m not entirely sure what is happing there. Xcode 12 dropped support for iOS 8, so the “range of supported versions” is referring to Xcode’s restrictions. If a dependency didn’t specify any deployment target, then it is supposed to default to the oldest available. Maybe there is a bug here where Xcode is defaulting to something older than it actually supports? I would ask the Xcode folks over at the Apple Developer Forums. (You can include a link to this thread.)

The default localization is the one that will actually be displayed on‐screen if the package doesn’t have any of the languages the user asked for. For example, if the package provides Chinese, Spanish, and English, then the one selected as default determines what a user whose computer is in Hindi will see. Every localized resource must exist in that localization.

Base is a completely different thing. It’s not really a localization itself, but rather a place for files that are partially shared between many localizations.

@SDGGiesbrecht Thank you so much for detailed information and let me Xcode warning in forums