product 'KeychainSwift' required by package 'mytarget' target 'MyTarget' not found.
I tried many things, like changing the name to keychain-swift, as the compiler sometimes gave an extra message at the error like: valid product names are 'keychain-swift', but that also didn't work.
Cause:
This issue happens when packages specify a different Package.name property compared to the github repo name. E.g. KeychainSwift's repo name is keychain-swift but the Package.swift says is called KeychainSwift.
I'm posting this here so it hopefully helps someone else as well. I don't know if it should be updated in the Readme.md, if so, I can make a PR for that.
The solution is to specify a name as well for my Package.swift:
Description
When I added this library to my own Swift Package, I couldn't seem to link the library to my package. My setup in the
Package.swift
:Which gave the error:
I tried many things, like changing the name to
keychain-swift
, as the compiler sometimes gave an extra message at the error like:valid product names are 'keychain-swift'
, but that also didn't work.Cause:
Source
Solution:
I'm posting this here so it hopefully helps someone else as well. I don't know if it should be updated in the
Readme.md
, if so, I can make a PR for that.The solution is to specify a
name
as well for myPackage.swift
: