ios – Swift Package deal referencing one other Swift Package deal regionally, not acknowledged by check goal

[ad_1]

I have been making an attempt to refactor an current swift bundle I made into a number of swift packages.

I began by shifting code from the unique bundle (“Guardian”) bundle right into a second bundle (“Little one”) they usually’re in the identical xcworkspace. After making the code I wanted public and utilizing import Little one on the recordsdata the place these methodology signatures from Little one are known as, the primary goal builds.

The problem arises when I attempt to run checks. The checks contained in the Little one bundle run wonderful, however when the Guardian’s checks attempt to construct it fails to hyperlink with these errors…

Undefined image: protocol descriptor for Little one.SomeProtocol

Undefined image: (extension in Little one):Little one.SomeProtocol.methodology(param: CoreGraphics.CGFloat) -> CoreGraphics.CGFloat

Undefined image: static (extension in Little one):Swift.Double.computedProperty.getter : Swift.Double

…with one other indicator pointing to the import assertion.

Very first thing I did was add the Little one goal to the Guardian’s construct scheme, with “Take a look at” and “Run” checked off. Then I attempted adjusting the Guardian’s bundle file by including the Little one to the check goal’s dependencies…

targets: [
    .target(
        name: "Parent",
        dependencies: [],
        assets: [.process("Resources")]),
    .testTarget(
        identify: "ParentTests",
        dependencies: ["Parent"/*, "Child"*/]),  // <-- Half inside /* feedback */ is what I added
]

Then my errors change to…

product ‘Little one’ required by bundle ‘Guardian’ goal ‘ParentTests’ not discovered.

Though the mission acts prefer it’s constructed efficiently, I solely see the error when I attempt to run checks and get a pop up that claims:

There are not any check bundles accessible to check.

Be certain that all bundle dependencies have resolved and that there are not any lacking check bundles within the lively scheme or check plan.

I discovered directions for internet hosting the bundle on github, however that launched an entire different set of issues. To maintain it easy, how do I correctly hyperlink the Little one bundle to the Guardian as a neighborhood dependency in my workspace?

Additionally, I seen that the difficulty is not only with checks, however when I attempt to construct the host App that owns the Guardian bundle I get comparable errors.

Beneath are the precise packages for my Guardian (“Trenches_Engine”) and Little one (“Math”) packages…

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

import PackageDescription

let bundle = Package deal(
    identify: "Trenches_Engine",
    platforms: [
        .iOS(.v14)
    ],
    merchandise: [
        // Products define the executables and libraries a package produces, and make them visible to other packages.
        .library(
            name: "Trenches_Engine",
            targets: ["Trenches_Engine"]),
    ],
    dependencies: [
        // Dependencies declare other packages that this package depends on.
        // .package(url: /* package url */, from: "1.0.0"),
    ],
    targets: [
        // Targets are the basic building blocks of a package. A target can define a module or a test suite.
        // Targets can depend on other targets in this package, and on products in packages this package depends on.
        .target(
            name: "Trenches_Engine",
            dependencies: [],
            assets: [.process("Resources")]),
        .testTarget(
            identify: "Trenches_EngineTests",
            dependencies: ["Trenches_Engine", "Math"]),
    ]
)
// 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: "Math",
    merchandise: [
        // Products define the executables and libraries a package produces, and make them visible to other packages.
        .library(
            name: "Math",
            targets: ["Math"]),
    ],
    dependencies: [
        // Dependencies declare other packages that this package depends on.
        // .package(url: /* package url */, from: "1.0.0"),
    ],
    targets: [
        // Targets are the basic building blocks of a package. A target can define a module or a test suite.
        // Targets can depend on other targets in this package, and on products in packages this package depends on.
        .target(
            name: "Math",
            dependencies: []),
        .testTarget(
            identify: "MathTests",
            dependencies: ["Math"]),
    ]
)

[ad_2]

Leave a Reply

Your email address will not be published. Required fields are marked *