Can't import packages using Swift 4 Package Manager Can't import packages using Swift 4 Package Manager xcode xcode

Can't import packages using Swift 4 Package Manager


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