0

I have objc project https://github.com/facebookincubator/SocketRocket which I forked and adding SPM support. I create Package.swift:

let package = Package(
    name: "SocketRocket",
    platforms: [
        .iOS(.v12)
    ],
    products: [
        .library(
            name: "SocketRocket",
            targets: ["SocketRocket"]
        )
    ],
    targets: [
        .target(
            name: "SocketRocket",
            path: "SocketRocket",
            publicHeadersPath: "."
        ),
        .testTarget(
            name: "SocketRocketTests",
            dependencies: ["SocketRocket"],
            path: "Tests"
        )
    ]
)

There is an umbrella header file inside of project SocketRocket.h:

#import <SocketRocket/NSRunLoop+SRWebSocket.h>
#import <SocketRocket/NSURLRequest+SRWebSocket.h>
#import <SocketRocket/SRSecurityPolicy.h>
#import <SocketRocket/SRWebSocket.h>

I created a modulemap:

module SocketRocket {
    header "SocketRocket.h"
    export *
}

But there is issue in building package: Building for debugging... fatal error: 'SRDelegateController.h' file not found #import "SRDelegateController.h" ^~~~~~~~~~~~~~~~~~~~~~~~ 1 error generated.

I think imports is not applying, every time I run again and again there is different number of compiled files(0, 3, 4, 19):

[0/19] Compiling SRIOConsumerPool.m

I'm expecting to solve my problem.

Project Structure

4
  • You need use publicHeadersPath and don't need use modulemap Commented Aug 1, 2024 at 12:15
  • But I dont have modulemap in the project Commented Aug 1, 2024 at 12:16
  • UPD same issue with or without modulemap Commented Aug 1, 2024 at 12:25
  • For SPM with Objective-C file you need to put all header (.h) files in the same folder (eg: include). Look here Commented Aug 30, 2024 at 15:19

0

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.