2021 Developer ToolsSwift
WWDC21 · 14 min · Developer Tools / Swift
Discover and curate Swift Packages using Collections
Whether you’re curating packages for your team, for education purposes, or to share with other developers, Swift Package Collections can help you discover, explore and import new packages into your project. Discover improvements in the Swift Package workflow using Collections, and learn how you can curate, create, sign, and share your own Swift Package Collections.
Watch at developer.apple.com ↗Code shown on screen · 8 snippets
Simple collection
{
"name": "WWDC21 Demo Collection",
"overview": "Packages to be used in our demo app",
"keywords": ["wwdc21"],
"author": {
"name": "Boris Buegling"
}
"packages": [
{ "url": "https://github.com/apple/swift-format" },
{ "url": "https://github.com/Alamofire/Alamofire" }
],
} Complex collection
{
"name": "WWDC21 Demo Collection",
"overview": "Packages to be used in our demo app",
"keywords": ["wwdc21"],
"packages": [
{
"url": "https://github.com/apple/swift-format",
"summary": "Formatting technology for Swift source code.",
"keywords": [“formatting”, "swift"],
"versions": ["0.50400.0", "0.50300.0"],
"excludedProducts": ["SwiftFormatConfiguration"],
"readmeURL": "https://github.com/apple/swift-format/blob/main/README.md"
},
{ "url": "https://github.com/Alamofire/Alamofire" }
],
"author": {
"name": "Boris Buegling"
}
} Generating a collection
package-collection-generate --verbose input.json collection.json --auth-token Signing a collection
package-collection-sign collection.json collection-signed.json developer-key.pem developer-cert.cer Adding a collection
swift package-collection add Inspecting an entire collection
swift package-collection describe Viewing metadata of the swift-format package
swift package-collection describe https://github.com/apple/swift-format ReadMe Request
import Alamofire
struct ContentView: View {
let readMeURL = "https://raw.githubusercontent.com/apple/swift/main/README.md"
var body: some View {
Button("Click me!") {
AF.request(readMeURL).response { response in
debugPrint(response)
}
}
}
} Resources
Related sessions
-
33 min -
33 min -
31 min