1
votes

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)

1
That's very strange. We have this example if it's helpful. github.com/IBM-Swift/TodoList-CouchDB but it's doing exactly what you described above. - Robert F. Dickerson
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
@VadimEisenberg I just updated the original question with additional details. - john doe
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
Can you try this repo 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

1 Answers

2
votes

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