Search code examples
swiftswift-package-manager

No such module 'Combine' when used in my Swift Package


When I create a swift package, and then I use the simple line:

import Combine

I get the following error:

No such module 'Combine'

I've switched my scheme to Any iOS Device

enter image description here

I also set the platform in the Package.swift file

import PackageDescription

let package = Package(
    name: "AsyncImageView",
    platforms: [.iOS(.v8)],
    products: [

It still does not accept Combine.


Solution

  • Combine is iOS 13 and/or macOS 10.15 or later, only. You need to guarantee the compiler and linker of that condition. Change your package to include

    platforms: [
        .iOS(.v13), .macOS(.v10_15)
    ],
    

    Now build the package scheme, then build the project scheme, and you're all set.