Developing a local Swift Package alongside an app
local package development workflow.
add the package as a local dependency by dragging its folder into the project or workspace, so Xcode references the source on disk and rebuilds edits immediately.
WHAT THIS TESTS This checks practical knowledge of iterating on shared code without the friction of publishing, a daily reality when an app and its packages evolve together.
A GOOD ANSWER COVERS The key idea is a local package dependency. You add the package by dragging its root folder into the app's project navigator or workspace, or by choosing Add Package Dependencies and selecting Add Local with a filesystem path. Xcode then references the package's source files directly on disk instead of resolving a remote Git revision. Editing the package's Swift files and rebuilding the app compiles the latest source immediately, with no commit, tag, or version bump required. A useful detail: if a local package shares the name of a remote dependency the app already declares, Xcode prefers the local copy, which lets you patch a remote package locally during development. When finished you remove the local reference and the app resumes resolving the published version.
COMMON WRONG ANSWERS Describing the publish loop of commit, push, tag a version, then bump the app's dependency for every change, which is slow and pollutes history. Confusing this with editable installs from other ecosystems. Forgetting that a local reference shadows the remote one of the same name.
LIKELY FOLLOW-UPS How does a local package override a same-named remote dependency? How do you structure a workspace so multiple developers can do this? How do you switch back to the published version cleanly before merging?
ONE CONCRETE EXAMPLE You maintain a Networking package consumed by your app via its GitHub URL. To fix a bug you clone the package locally and drag its folder into the app's workspace as a local package. Xcode now builds the app against the on-disk source, so each edit and rebuild reflects instantly without any push. Because the local package's name matches the remote dependency, Xcode uses your local copy. Once the fix is verified you remove the local folder reference and push a tagged release, and the app returns to the published version.
Read the original → developer.apple.com
Get five bites like this every day.
Tezvyn delivers a daily feed of 60-second tech bites with quizzes to lock in what you learn.