Can't import packages using Swift 4 Package Manager

拈花ヽ惹草 提交于 2019-12-02 20:19:40

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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!