fbartho,
@fbartho@mastodon.social avatar

I’m trying to make a package that vends at least two libraries.

The package builds each library fine, and I had no problem importing the first library into my app, but when I try to import the second library, it tells me “Cannot find ‘Foo’ in package. Did you mean ‘Foo’”

I’ve been fighting this for a few days. Any advice or pointers to projects I can learn from?

finestructure,
@finestructure@mastodon.social avatar

@fbartho Hard to tell without seeing the package manifest / source. Is your Foo declared public? Do you have a name collision? Is your library declared as a product in the manifest?

Maybe this small package can give you pointers: https://github.com/SwiftPackageIndex/SemanticVersion

fbartho,
@fbartho@mastodon.social avatar

@finestructure As I was cleaning up my code to try to share it, I got a different error-message.

Specifying the package: “PackName” in my .product dependency line solved my issue.

I guess the problem was that I had an implicit package name, and in the working case swiftpm was reading the ProductName & implicitly assuming that was also the PackageName.

The working case happened to be a library that matched the name of the root folder. So everything failed only on the second lib.

Thank you!

finestructure,
@finestructure@mastodon.social avatar

@fbartho Glad to hear you figured it out!

  • All
  • Subscribed
  • Moderated
  • Favorites
  • swift
  • DreamBathrooms
  • mdbf
  • ethstaker
  • magazineikmin
  • cubers
  • rosin
  • everett
  • Youngstown
  • khanakhh
  • slotface
  • Durango
  • kavyap
  • InstantRegret
  • thenastyranch
  • JUstTest
  • osvaldo12
  • GTA5RPClips
  • modclub
  • cisconetworking
  • provamag3
  • normalnudes
  • ngwrru68w68
  • tacticalgear
  • tester
  • megavids
  • anitta
  • Leos
  • lostlight
  • All magazines