How do I create a Package.swift file for a package in Xcode's package manager?

372 Views Asked by At

I'm trying to use SwiftyJSON within an Xcode project via the built in package manager. The first time I try to add it through Xcode, The app complains about missing Swift-tools version specification like so: enter image description here

After clicking "Add Anyway" the package came in, but it appears grayed out and doesn't have the usual hierarchy:

enter image description here

After removing it and adding it again, the package apppears like normal. But I get "cannot find in scope" errors when I try to import it using import. enter image description here

SwiftyJSON's documentation states there's an extra step involving making changes to Package.swift. But I have no idea which one they are talking about. I tried to change the one in the package dependencies section, but it won't let me make any changes to the file.

Where am I supposed to put the code needed? I really don't want to use Cocoapods or Carthage because I like specifically how Xcode's package manager lets you import packages directly from GitHub in a couple of clicks without needing to switch over to the terminal.

0

There are 0 best solutions below