Frequently Asked Questions
- What is the Swift Package Index?
- What is the Swift Package Manager?
- Who built the Swift Package Index?
- What happened to the SwiftPM Library?
- How does the Swift Package Index work?
- What about the GitHub Package Registry?
- How do I define Language and Platform information?
- What do the license colours mean?
- Can I contribute?
- Is there an API?
- Why are package versions missing?
What is the Swift Package Index?
The Swift Package Index is a search engine for packages that support the Swift Package Manager.
But this site isn't simply a search tool. Choosing the right dependencies is about more than just finding code that does what you need. Are the libraries you're choosing well maintained? How long have they been in development? Are they well tested? Picking high-quality packages is hard, and the Swift Package Index helps you make better decisions about your dependencies.
What is the Swift Package Manager?
The Swift Package Manager is a tool built by Apple as part of the Swift project for integrating libraries and frameworks into your Swift apps. It launched in 2015 and gained integration with Xcode 11 in 2019.
To find out more about the Swift Package Manager, there's documentation on the Apple developer site.
Who built the Swift Package Index?
What happened to the SwiftPM Library?
This site is a spiritual successor and replacement for the SwiftPM Library. It has been re-implemented from scratch in Swift using Vapor and has had a name change at the same time. We learned many valuable lessons from the original implementation, and the Swift Package Index is the future of Swift package search.
How does the Swift Package Index work?
The data in this index originates from this list of repositories. When someone adds a repository to the package list, this site immediately makes a full clone of the package source. Metadata is extracted from the source code and local git history, as well as from the hosted repository on GitHub.
Packages are also polled for changes every few hours, so the information you see in the index always reflects the latest package releases, without any action required from the package author.
What about the GitHub Package Registry?
We’re excited to see the GitHub Package Registry gain support for the Swift packages. There’s a proposal under discussion for the Swift Package Manager support to support package registries formally, but a package registry is not a package search engine like this site is. If the Swift project accepts the proposal, this site will support and index the GitHub Package Registry, and any other significant implementation of a package registry as they become available.
How do I define Language and Platform information?
The more metadata the Swift Package Index knows about your package, the better we can present it to people looking for packages. However, we need package authors to inform us of what platforms and languages their packages require, and support.
Are you a package author? Does your package listing currently look like this?
Read on to learn how to specify this information in your
Providing Swift language version metadata
Define the versions of Swift that your package is compatible with by setting the
swiftLanguageVersions property in your package manifest,
Package.swift. This property is an array of
swiftLanguageVersions: [.v4, .v4_2, .v5]
SwiftVersion does not define all versions of Swift, only significant versions. For example, if your package supports Swift 5, 5.1, and 5.2 then your
swiftLanguageVersions should look like this:
Once you push an updated
Package.swift to your project's hosted repository, the Swift Package Index will re-scan and pick up your new metadata within a few hours. After the update, your listing will look something like this:
Note: Be careful not to mix up
swiftLanguageVersions with the
swift-tools-version comment at the top of your
swiftLanguageVersions defines the version(s) of Swift your package supports, and
swift-tools-version determines what version of Swift is required to parse the
Package.swift file. The Swift Package Index only parses the
Providing platform compatibility metadata
Define the Apple platforms (iOS, macOS, watchOS, or tvOS) that your package is compatible with by setting the
platforms property in your package manifest. This property is an array of
platforms: [.macOS(.v10_12), .iOS(.v10), .tvOS(.v10), .watchOS(.v3)]
Push an updated
Package.swift and the Swift Package Index will automatically update within a few hours. Once it updates, your listing will look like this:
Package.swift does not currently support platform metadata to indicate whether a package is compatible with Linux. If this ever changes, the Swift Package Index will support it.
What do the license colours mean?
If a package's license shows with a background that is orange or red, it is for one of three reasons:
- The package does not have a license.
- We're unable to detect the software license that the package uses.
- The license chosen by the package authors is incompatible with the terms and conditions of the App Store.
If the package license is showing as "No License", it means we could not find any license information in the package repository.
If you are considering using a package that does not have a license, you should be aware that it presents a significant legal risk. Code without a license is not open-source, and the original author reserves all rights by default. For more information, read this great blog post on the significant risks of using unlicensed code.
If you are the package author, you can fix this by adding a
LICENSE file with an open-source license that is compatible with the terms and conditions of the App Store. The Swift Package Index will update license metadata a few hours after you push a license to the repository.
If the package license is showing as "Unknown License", it means we have been unable to detect the license.
If you are considering using a package with an unidentified license, you should check the package's repository for the details in the
LICENSE file. If the license details are not clear, you should treat the code as unlicensed and see the section above.
If you are the package author and would like to fix this, please see GitHub's documentation. The Swift Package Index will update licenses a few hours after GitHub recognises a valid license.
If the package license shows with an orange background but does not say "No License" or "Unknown License", then the package is using a license which is incompatible with the terms and conditions of the App Store, such as any GPL style license.
If you are considering shipping your app to the App Store, you should be aware that using code licensed under one of these licences presents a legal risk.
Can I contribute?
All participation in this project, whether it be contributing code or discussions in issues are subject to our code of conduct. Please read CODEOFCONDUCT.md for more information.
Is there an API?
Not right now. The Swift Package Index is in a period of rapid development right now, and we'd like the flexibility to change things around at this stage in the project's life. It's on the list for the future though!
Why are package versions missing?
Package releases must use git tags that are fully qualified semantic versions. For example,
2.6.0 is a valid semantic version number, and
2.6 is not.
A good way to check what the latest semantic version release of a package is is to add it to a project in Xcode. By default, Xcode will show the latest semantic version when adding the package to a project. The number you see on this site should match the version Xcode shows when adding the package. If you see something different, please raise an issue!