I'm facing problems while importing a library I created.
This is the Package.swift
of my executable
:
import PackageDescription
let package = Package(
name: "PayBackCodingChallenge",
dependencies: [
.package(url: "../NumberChecker", from: "1.0.0"),
],
targets: [
.target(
name: "PayBackCodingChallenge",
dependencies: []),
]
)
When I try to import NumberChecker
in my main.swift
I get the following message: No such module 'NumberChecker':
import NumberChecker
let arguments = CommandLine.arguments
if arguments.count != 3 {
print("USAGE: PayBackCodingChallenge [data] [target]")
print(" data: File containing list of numbers ")
print(" target: Target number")
} else {
let data = arguments[1]
let target = arguments[2]
print(data + " " + target)
}
My NumberChecker library is located in a directory at the same level as PayBackCodingChallenge and compiles correctly. What could be the problem?
Thanks in advance!
You should add NumberChecker
as a dependency to PayBackCodingChallenge
:
...
targets: [
.target(
name: "PayBackCodingChallenge",
dependencies: ["NumberChecker"]),
]
...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With