1

I am trying to use CouchDB in my Kitura server side Swift app. I have my Package.swift with all the dependencies as shown below:

let package = Package(
    name: "hello-kitura",
    dependencies:[
        .Package(url:"https://github.com/IBM-Swift/Kitura.git",majorVersion:1),
        .Package(url:"https://github.com/IBM-Swift/HeliumLogger.git",majorVersion:1),
        .Package(url:"https://github.com/IBM-Swift/Kitura-StencilTemplateEngine.git",majorVersion:1),
        .Package(url: "https://github.com/IBM-Swift/Swift-Kuery-PostgreSQL",majorVersion:0),
        .Package(url: "https://github.com/IBM-Swift/Kitura-CouchDB.git",majorVersion:1)
    ]
)

From the command line I ran the following to download the dependencies:

swift build 

In my main.swift I have the following code:

import CouchDB   <-- No such module CouchDB 

As you can see I get "No such module CouchDB". Any ideas!

UPDATE:

OS Version: OSX El Capitan 10.11.6 Apple Swift version 3.0.2 (swiftlang-800.0.63 clang-800.0.42.1) Apple Swift Package Manager - Swift 3.0.2 (swiftpm-11750)

john doe
  • 9,220
  • 23
  • 91
  • 167
  • That's very strange. We have this example if it's helpful. https://github.com/IBM-Swift/TodoList-CouchDB/ but it's doing exactly what you described above. – Robert F. Dickerson Mar 17 '17 at 16:55
  • Could you please provide some details: 1) The OS version you run swift build 2) swift and swift build versions: `swift --version` and `swift build --version` – Vadim Eisenberg Mar 17 '17 at 17:09
  • @VadimEisenberg I just updated the original question with additional details. – john doe Mar 17 '17 at 17:15
  • UPDATE: I created a brand new project and it worked out fine without any issues. No idea what went wrong with the previous project. – john doe Mar 17 '17 at 17:35
  • Can you try this repo https://github.com/vadimeisenbergibm/hello-kitura ? It contains the same `Package.swift` and a simple `main.swift`. I have the same OS, swift and swift build as you and that example works for me. – Vadim Eisenberg Mar 17 '17 at 17:40
  • Yeah! I created the new proj and it started working fine. – john doe Mar 17 '17 at 17:49

1 Answers1

2

If you look at the Xcode Project Navigator you'll probably see that Kitura-CouchDB is missing from Dependencies (likely because you added it after you started the project). One way to restore it (after you commit or backup first) is to rerun:

swift package generate-xcodeproj

loopdoc
  • 21
  • 1