Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

No such module "PackageDescription"

I just started with swift 3 and made a simple app in xcode using Swift 3.0 . Now i want to add a third party library using Swift Package Manager . I am following installation method given in this link . I created Package.swift file which looks like this

import PackageDescription

let package = Package (
name : "SwiftPM",
dependencies : [
.Package(url: "https://github.com/ArtSabintsev/Siren.git", majorVersion: 1)
])

but i get error No such module "PackageDescription"

like image 522
Ahsan Attari Avatar asked Sep 30 '16 15:09

Ahsan Attari


1 Answers

The Swift Package Manager and Xcode are orthogonal. That is, you can't expect to compile Package.swift in Xcode; it simply won't work. Instead, until Xcode supports the package manager, you need to have two distinct builds - one with the package manager and one with Xcode.

So, using the Swift Package Manager, once you've defined Package.swift and formulated your directory structure as expected by the package manger, you perform simply:

swift build

Then for Xcode, you create an Xcode project that uses your source code, but not Package.swift. You'll need to clone the Siren.git project, explicitly - into your Xcode build's source files.

like image 198
GoZoner Avatar answered Sep 21 '22 09:09

GoZoner