XcodeCloudKit is a Swift SDK that makes working with the Xcode Cloud endpoints from the App Store Connect API a breeze!
XcodeCloudKit relies on Antoine Van Der Lee's appstoreconnect-swift-sdk, which provides a fantastic Swift interface to interact with the App Store Connect API.
The App Store Connect API requires all network requests to be authenticated and, as it does not support OAuth, you must create an API key from the dashboard.
Once you have generated a key, you must initialise the SDK by using its Factory enum:
import XcodeCloudKit
letxcodeCloudKit=tryFactory.make(
issuerID:"🙈",
privateKeyID:"🙈",
privateKey:"🙈")XcodeCloudKit's structure tries to mirror Xcode Cloud's data structure as closely as possible and has three main entities: products, workflows and builds.
Products are the Xcode Cloud representations of your app and you can request a list of them and select one using the SDK:
// Get a list of all available products
letallProducts=tryawait xcodeCloudKit.allProducts()
// Get a product by Xcode Cloud ID
letproductById=tryawait xcodeCloudKit.product(withId:"...")
// By repository name
letproduct=tryawait xcodeCloudKit.product(withRepositoryName:"NowPlaying")Once you have a product, you can access one or all of its workflows, which are the blueprints of your CI/CD pipelines, directly on the instance:
// Get a list of all available workflows
letallWorkflows=tryawait product?.workflows()
// Get a workflow by Xcode Cloud ID
letworkflowByID=tryawait product?.workflow(withId:"...")
// Get a workflow by name
letworkflow=tryawait product?.workflow(withName:"Test Workflow")Once you have a workflow, you can access the list of builds or workflow runs for a specific workflow:
// Get a list of all available builds
letallBuilds=tryawait workflow?.allBuilds()
// Get a build by its number
letbuild=tryawait workflow?.build(withNumber:32)And you can even start a new build for a specific workflow at a git reference of your choice:
tryawait workflow?.start(atGitReference:.branch(name:"main"))Note that the SDK's functionalities are limited at the moment and more features will get added in the coming days and months.
As it stands, XcodeCloudKit can only be installed via SPM as follows:
dependencies:[.package(url:"https://github.com/runway-org/xcode-cloud-kit.git",.upToNextMajor(from:"0.1.0"))]XcodeCloudKit is available under the MIT license, and uses source code from open source projects. See the LICENSE file for more info.
This project is developed and maintained open source by Runway and lead by Pol Piella Abadia.