I am very new to swift and XCode. Yesterday I was working on a project and wanted to try out a custom date picker somebody had made, so I went to ‘Add packages’ and pasted the GitHub link and added it (I had already added a different package called KeychainAccess to my project that way). I then realized, that this wasn’t the correct way to add this to my project, and that I just had to drag the correct folder from the project into my own project.
I wanted to delete it again, so I went to the same ‘Add packages’ page and highlighted the package and clicked on the little ‘-‘ at the bottom left because I thought that was how to get rid of it. A little popup came up asking if I was sure I wanted to move this to the trash and I clicked yes. However, noticed that it was called something along the lines of ‘Swift Packages’, but I had already clicked so I couldn’t stop it.
I didn’t see any errors anywhere so I didn’t think much about it and just carried on and did my thing and everything worked. Today, however, when I turned on my Mac, there were a bunch of errors that were all related to the other package I had added. It said "Missing package product ‘KeychainAccess’".
I checked on YouTube and watched a video of somebody adding a package to their project and they had this ‘Apple Swift Packages’ collection, which I do not have anymore. This is why I believe that I have accidentally deleted it.
When I click on the + icon to add a new package, it asks me for a URL. Does anybody know if I can add this back into my project?
2
Answers
Ok, so I have fixed my problem and it turns out that I was wrong. I talked to someone more experienced than me and he guided me through fixing it. He told me that nothing is deleted and there is nothing wrong. I just had to File > Pckages > Resolve Package Versions and then I had to quit XCode and open it again and then it all worked. I'm still not very sure what happened yesterday or what I deleted but it's not impacting my project so I'll just ignore it
You can always add them back manually :
File > Add Packages…
Click on "+" button, use following link for "Apple Swift Packages" :