Trying to test Swift 4 using Xcode-beta (v9) on my machine and having issues with importing packages into a test project:
swift packa
Turns out I had to also include the dependencies into the .target
of the Package.swift:
.target(named: "sampleproject", dependencies: ["Kitura", "Alamofire"])
and build the project again.
Even though you need to add the target
into the Package.swift
sometimes it's not enough. I have fixed the issue by deleting the .build
dir and the file Package.resolved
, then running swift build
or build from Xcode. Build command was not fetching packages as it was already in resolved
file but if you delete the .build
dir it becomes meaningless. You can verify it by checking the Dependencies
dir from Xcode it will be empty if there is error like No such package/module