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: Create a package called MyLibrary Create a new Project App MyLibraryDemo inside the package directory Open the project’s .xcodeproj file Go to PROJECT > MyLibraryDemo > Package Dependencies and press the ‘plus’ symbol Press Add Local and select the directory containing your pacakge Go … Read more

When using Swift Package Manager how can I generate an Xcode project file for development

Update: as mentioned in other answers, you can now generate Xcode project files with this command: swift package generate-xcodeproj Original answer: The Swift Package Manger (SPM) is cross platform, It works on Mac and Linux. The Xcode is Mac OS only, so I don’t think SPM will be hard integrate to work with Xcode. SPM … Read more

How to use Swift Package Manager with private repos?

A solution, for Unix-like systems, is to use SSH git URLs and add Host configurations to ~/.ssh/config. This approach works for both macOS/Linux command line and Xcode. Use a ssh form for the dependency url in Package.swift. // swift-tools-version:4.0 import PackageDescription let package = Package( name: “Example”, dependencies: [ .package(url: “[email protected]:abc/private-repo.git”, .branch(“develop”) ), ], ) … Read more

How to Install Package in Xcode via Swift Package Manager

Swift Package Manager now support generating Xcode project with swift package generate-xcodeproj as mentioned in this answer, but this only works when developing a library, or a command line tool. Not (yet) for (iOS/OS X) graphical application developer: Note that at this time the Package Manager has no support for iOS, watchOS, or tvOS platforms. … Read more

How can I reset the package cache on just one package with Swift Package Manager

To reset the cache for a single package: Navigate to ~/Library/Caches/org.swift.swiftpm/repositories and deleting the folder and lock file related to the package Then, in Xcode, run File–>Swift Packages–>Reset Package Caches You can also try the solution recommended here to reset the entire cache (thanks @Bao Lei): https://stackoverflow.com/a/72838880/1099193

Xcode 14.3 build error “unable to initiate PIF transfer session (operation in progress?)”

UPDATE: As some others have mentioned, this can be fixed by simply closing Xcode and re-opening it, then doing a regular build (Command+B) instead of running it. Give that a shot before trying the other options! The error seemed to be resolved by doing the following: Close Xcode Open finder, and delete the derived data … Read more

tech