I have removed GitHub account in Xcode and added it again
I am confused if I am missing something very obvious, any help on this is much appreciated.
Questions
Is there any workaround or way to fix this issue?
Why does this take such a long time when I have a specific URL, either it needs to add it or return that the package is not found. Why is it searching?
I've found that, even when stuck spinning like that, putting a repo address in the search field can often get it to do the search and show proper results anyway, so you can try it. If you have a system proxy you can see what Xcode is trying to call and perhaps block it so it fails quickly rather than hanging.
I had given it over 15 minutes, however may be I will let it continue to search. I will also see if there is a way to monitor / block the incorrect paths.
I had the same issue and it's probably not really helpful, but after trying all the things you have and more I only managed to fix it by factory resetting my mac. A bit extreme but I had work to do and after a week of troubleshooting and having to fall back to using one of our older macs I had had enough.
I did have SSH configured and since I use about 20 packages, all from a personal repository I had to go and mirrors.json all of them since Xcode would keep saying that the SSH fingerprint was unknown. Even after clicking the error and trusting it.
Perhaps it loads infinitely because Xcodes built-in package manager tries to load all recent packages and then it gets stuck on the SSH ones?
Not sure what causes it. I never experienced infinite loading on my work at home mac, but my at work mac refused to load.
Ah sorry I wasn't being very clear. I was getting an error when trying to update packages in existing projects with SSH dependencies on my private repo.
It might be interesting to see (if possible) if you can update your package dependency via SSH in an existing project. I experienced both the infinite loading for adding a dependencty and the updating an existing dependency issue so they might be related to each other.
I had a project with Swift Package A, I was able to edit that and change the URL to Swift Package B and now B gets pulled properly and I can see the files in B.
While editing an existing URL to a new URL there is no search screen, it is a simple edit. So the spinning issue doesn't exist during edit.
So the problem seems to be the UI which searches the package.
Is there a way around this to directly specify Swift Package URL without searching screen?
@Aquaculture Thanks a ton!!! Your suggestion led me to the solution.
Problem
The actual issue for me is Xcode when adding a new package and entering the URL in the search box where it keeps spinning (even over an hour) never ends.
Workaround
Add one of the Apple Swift Packages which comes pre-loaded with Xcode like swift-algorithms
Once added that screen gets dismissed and the swift-algorithms URL is added as a dependency
Now click on the swift-algorithms and change it to your URL and also update the Dependency Rule
This will add the your swift package and pull the code.
Side note: Realized I needed to add SSH key anyway to work with Xcode, so added that
Thank you so much @Aquaculture made my day! Was breaking my head over it.