Swift Package has no symbols?

I'm reading this piece of documentation on creating CXX SPM targets. I want to specify the headers manually in a module.modulemap file like it says I can do below the bullet points.

My Package.swift looks like this:

// swift-tools-version:5.0
import PackageDescription

let package = Package(
    name: "TBAlertController",
    platforms: [
        .iOS(.v8)
    ],
    products: [
        .library(name: "TBAlertController", targets: ["TBAlertController"])
    ],
    targets: [
        .target(
            name: "TBAlertController",
            path: "Classes"
        )
    ]
)

And my folder structure is like so:

.
├── Classes
│   ├── TBAlertAction.h
│   ├── TBAlertAction.m
│   ├── TBAlertController.h
│   └── TBAlertController.m
├── Package.swift
├── TBAlertController.podspec
└── include
    └── module.modulemap

The documentation is a little vague here… Is the include folder supposed to go alongside the Package.swift? Or does it go in the target path under Sources or the one specified in the Package.swift? (Classes/include/)

And while I'm here… would this be the correct format for the modulemap file?

module TBAlertController [library] {
  header "relative/path/to/TBAlertController.h"
  header "relative/path/to/TBAlertAction.h"
  export *
}

The “include” directory goes into the target’s path, so in your case that would be “Classes” since you override it.

Gotcha, thank you.

With that out of the way… I still can't seem to get my classes visible in a project using my package. Not sure what I'm doing wrong.

This the package: https://github.com/NSExceptional/TBAlertController

I can import it, but ⌘-clicking it in Xcode shows me an empty file. Any ideas?

Terms of Service

Privacy Policy

Cookie Policy