简体   繁体   中英

Swift 3 no such module within Xcode 8.1

Consider me an absolute newbie for Swift 3. Everything I read seems to contradict each other. I am trying to test the MongoKitten module.

I managed to create a simple Xcode 8.1 project with my Package.swift containing:

import PackageDescription

let package = Package(
    name: "MongoKittenTest",
    dependencies: [
       .Package(url: "https://github.com/OpenKitten/MongoKitten.git", majorVersion: 2, minor: 0)
    ]
) 

As instructed in the link above, I create a swift source file with a simple line of:

import MongoKitten

When I build (from within Xcode), i get a 'no such module MongoKitten'. I know this is trivial but I can build everything within when I run swift build in a terminal with no issue. How is it not possible to build within Xcode? How do I fix this issues to build within Xcode. Thanks

I hope you've managed to find your answer by now but I'll post my two cents here. Your Package.swift is correct, but you'll need to generate an Xcode project from SPM using swift package generate-xcodeproj on the command line. After that you can open your MongoKittenTest.xcodeproj file using Xcode which would allow you to start.

MongoKitten 3 will be released within the next few days, so you'd need to change the majorVersion to 3 if you were to use the new features and documentation.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM