Can't import packages using Swift 4 Package Manager

后端 未结 2 908
野趣味
野趣味 2021-02-01 03:17

Trying to test Swift 4 using Xcode-beta (v9) on my machine and having issues with importing packages into a test project:

  • Initiated project using swift packa
相关标签:
2条回答
  • 2021-02-01 03:42

    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.

    0 讨论(0)
  • 2021-02-01 03:42

    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

    0 讨论(0)
提交回复
热议问题