Tuesday, June 30, 2026
HomeiOS Developmentios - How do I specify the headers listing for a objc...

ios – How do I specify the headers listing for a objc goal in Swift Package deal Supervisor’s Package deal.swift?

[ad_1]

I am making an attempt to transform a cocoapod undertaking to a spm library.
Nonetheless, the swift goal cannot discover this class in it is objc goal dependency.

Can not discover 'RMPhoneFormat' in scope

The Resolve Packages log tells me:

public headers ("embrace") listing path for 'CommonsObjc' is invalid or not contained within the goal

I suppose my objc goal cannot discover the headers within the folder I’ve specified.

What’s the base listing the place the publicHeadersPath is searching for the required folder? Is not {that a} sibling folder to the trail of the goal?

Why is the Resolve Packages log searching for a embrace listing after I specified headers ?

What am I lacking / not seeing?

My Package deal.swift file:

// swift-tools-version: 5.6
// The swift-tools-version declares the minimal model of Swift required to construct this bundle.

import PackageDescription

let bundle = Package deal(
    identify: "Commons",
    platforms: [
        .iOS(.v15)
    ],
    merchandise: [
        .library(
            name: "Commons",
            targets: [
                "CommonsSwift"
            ]
        )
    ],
    dependencies: [
        .package(url: "https://github.com/Cocoanetics/DTCoreText", exact: "1.6.26"),
        .package(url: "https://github.com/ashleymills/Reachability.swift", exact: "4.3.1")
    ],
    targets: [
        .target(
            name: "CommonsObjc",
            path: "Commons/objc",
            resources: [
                .process("RMPhoneFormat/PhoneFormats.dat")
            ],
            publicHeadersPath: "headers"
        ),
        .goal(
            identify: "CommonsSwift",
            dependencies: [
                .product(name: "DTCoreText", package: "DTCoreText"),
                .product(name: "Reachability", package: "Reachability.swift"),
                .target(name: "CommonsObjc")
            ],
            path: "Commons/swift",
            sources: [
                .process("Helpers/airportTimeZones.dat")
            ]
        )
    ]
)

File construction:

LibraryRootFolder/Commons:
.
├── Data.plist
├── Commons.h
├── headers
│   ├── Commons.h
│   └── RMPhoneFormat.h
├── objc
│   └── RMPhoneFormat
│       ├── PhoneFormats.dat
│       ├── RMPhoneFormat.h
│       └── RMPhoneFormat.m
├── swift
│   └── and so forth and so forth 

[ad_2]

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments