13

I'm trying to use updated SPM for Swift4 with the following Package.swift file - PackageDescription API Version 4

import PackageDescription

let package = Package(
    name: "Name",
    dependencies : [
        .package(url: "url", .branch("swift4"))
    ],
    exclude: ["Tests"]
)

I have a correct version of SPM also:

Apple Swift Package Manager - Swift 4.0.0-dev (swiftpm-13081.9)

But I can not build the library by swift build command. I see the following error:

... error: type 'Version' has no member 'branch'

1 Answer 1

28

You're missing the tools version specifier in your manifest; add the following as the first line of your Package.swift:

// swift-tools-version:4.0

By default if that line is omitted, it'll default to manifest version 3 and also compiler version 3. For more information see SE-0152 or Swift Package Manager Manifest API Redesign on swift.org.

1
  • 19
    Putting an essential variable in a comment? 🙁
    – Sentry.co
    Commented Oct 1, 2017 at 11:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.