Article

Developing a Swift Package in Tandem with an App

Add your published Swift package as a local package to your app’s project and develop the package and the app in tandem.

Overview

Swift packages are a convenient and lightweight solution for creating a modular app architecture and reusing code across your apps or with other developers. Over time, you may want to develop your published Swift package in tandem with your app, or even create a sample or demo app. You can leverage the behavior whereby a local package overrides a package dependency with the same name, as follows:

  • Add the Swift package to your app as a package dependency instead of a local package, as described in Editing a Package Dependency as a Local Package.

  • Develop your app and your Swift package in tandem, and push changes to their repositories.

  • When you release a new version of your Swift package, remove the local package from the app and update your package dependency to the latest version.

See Also

Local and Standalone Packages

Creating a Standalone Swift Package with Xcode

Bundle executable or shareable code into a standalone Swift package.

Organizing Your Code with Local Packages

Simplify maintenance, promote modularity, and encourage reuse by organizing your app’s code into local Swift packages.

Editing a Package Dependency as a Local Package

Override a package dependency and edit its content by adding a Swift package as a local package.

class Package

The configuration of a Swift package.