How can I add a demo app target to a Swift Package?

Here are the steps that worked for me on Xcode 13/14/15-beta:

  1. Create a package called MyLibrary

enter image description here

  1. Create a new Project App MyLibraryDemo inside the package directory

enter image description here

  1. Open the project’s .xcodeproj file

  2. Go to PROJECT > MyLibraryDemo > Package Dependencies and press the ‘plus’ symbol

enter image description here

  1. Press Add Local and select the directory containing your pacakge

enter image description here

  1. Go to the app’s TARGET > General > Frameworks, Libraries and Embeded Content, and press ‘add’

enter image description here

  1. Select your package from the list

enter image description here

  1. Now you can import your MyLibrary package into your example app, and edit / update your package from within you demo project.

enter image description here


Some Notes:

  1. If your package / demo has other dependencies, and those other dependencies get updated, you may have to clear DerivedData before doing an update

  2. You may also have to close & re-open Xcode, especially if you’ve updated dependencies, but it still says “Cannot find package MyLibrary

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)