2

Background:
This code is based on dated PM example written by Mattt years ago.

Goal: I'm trying to get importing to work, so I created a basic package; based on Mattt's working package. His example works flawlessly. Hence attempting to recreate from scratch.

Scenario:

  1. I've created a basic package.
  2. I've added a Dependency.
  3. I've added an 'import <Dependency' in package source but I'm getting the following build failure:

enter image description here

Here's the actual code:

// swift-tools-version:5.3 // The swift-tools-version declares the minimum version of Swift required to build this package. import PackageDescription let package = Package( name: "RicPackage", products: [ // Products define the executables and libraries a package produces, and make them visible to other packages. .library( name: "RicPackage", targets: ["RicPackage"]), ], dependencies: [ .package(name: "PlayingCard", url: "https://github.com/apple/example-package-playingcard.git", from: "3.0.0") ], targets: [ // Targets are the basic building blocks of a package. A target can define a module or a test suite. // Targets can depend on other targets in this package, and on products in packages this package depends on. .target( name: "RicPackage", dependencies: ["PlayingCard"]), .testTarget( name: "RicPackageTests", dependencies: ["RicPackage"]), ] ) 

Question: Why is this happening?
What am I missing?

1
  • I made the change that you suggest and added the 'name' field to the dependencies .package item per compiler suggestion. Now I'm getting a build FAILURE without explanation. Commented Jul 16, 2021 at 18:40

1 Answer 1

1

Gremlins?

I played around with the package header to notice changes in syntax acceptance. Then I reverted to the latest and did a recompile.

This time it SUCCEEDED.

I did a Xcode restart just to be sure this is true. I rebuild... again SUCCEEDED.

Note: be sure to be aware of the package header the says the version of the package. The package syntax (amongst other things) change/version.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.