-
-
Notifications
You must be signed in to change notification settings - Fork 48
FAQ
The more metadata the Swift Package Index knows about your package, the better we can present it to people looking for packages.
Does your package listing currently show this?
Two critical pieces of metadata are the supported Swift language versions and the supported platforms for your package.
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 SwiftVersion
enums:
swiftLanguageVersions: [.v4, .v4_2, .v5]
SwiftVersion
does not define all versions of Swift, only versions that made source breaking changes. For example, if your package supports Swift 5, 5.1, and 5.2 then your swiftLanguageVersions
should look like this:
swiftLanguageVersions: [.v5]
Once you add this key and push an updated Package.swift
. The Swift Package Index will 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 Package.swift
file. swiftLanguageVersions
defines the version(s) of Swift your package supports, and swift-tools-version
defines what version of Swift is required to parse your Package.swift
file. The Swift Package Index only parses the swiftLanguageVersions
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 SupportedPlatform
enums:
platforms: [.macOS(.v10_12),
.iOS(.v10),
.tvOS(.v10),
.watchOS(.v3)]
Add or update this property and push an updated Package.swift
. The index will update within a few hours, and your listing will look something like this:
Note: Unfortunately, Package.swift
does not currently support platform metadata that includes Linux compatibility. If this ever changes, the Swift Package Index will support it.