Add dependency on a local swift package in Xcode 11
Here is literally what I do and it just works... Xcode 11.2
I. Prepare package
File > New > Swift Package > Select Empty Folder (or create new) > Enter Library Name (MyLibrary)
Here in project find MyLibrary.swift and make public structure & variable, so there is some export to use in app (I made static constant and fixed UT)
Build > OK > Close Project
II. Prepare project
File > New > Project > iOS > Single View App > Enter Name (MyApp) > Next > Select Same Folder as above (it is by default) > Create
Build > OK
From Finder drag MyLibrary folder right below project name in Xcode Project Navigator
Build > OK
Click MyApp project icon in Project Navigator > Select MyApp application target > section Frameworks, Libraries, … click + > In topmost Workspace section select MyLibrary > Add
Clean > Build > OK
Open ContentView.swift > type
import MyLibrary
(autocompletion already see it)Replace “Hello, World” with "(MyLibrary.text)"Build & Run > OK
That’s it.
To verify used relative path open project.pbxproj in TextEdit, here is screenshot
Update:
Note1 - I've considered some delay in package resolving after Clean, so during some period of time, 1-2 mins here, Build fails exactly with reported error, but after that delay it is visible that index restarted and following Build succeeded.
Note2 - Adding second dependent package in graph (MyApp > MyLibrary > AnotherLibrary) is the same.