Questions tagged [swift-package-manager]

Swift Package Manager is a build tool and dependency manager for projects written in Swift. It is made by Apple and is open source.

Swift Package Manager is a build tool and dependency manager for projects written in Swift.

It is made by Apple and is open source. It is itself written in Swift.

The system uses a manifest file in the project directory, named "Package.swift", to describe dependencies and other facets of the project. The manifest itself is executable Swift code, and the project description is written as the initialization of a Swift class called Package.

1206 questions
309
votes
11 answers

How to delete Swift Package Dependency in Xcode 11?

I have a project in Xcode 11 that I added Swift Package Manager dependencies to. I now realized that I no longer need one of the package dependencies I previously added to my project. As you can see below, there are no options under File > Swift…
Charlie Fish
  • 18,491
  • 19
  • 86
  • 179
100
votes
6 answers

Consume Swift Package for multiple targets and platforms in a project?

I have a project with multiple targets, such as an iOS app, a watchOS app, and some frameworks. How can I assign the same Swift Package to all my targets? Xcode only let's me select one: If I try to add the Swift Package again so I can try…
TruMan1
  • 33,665
  • 59
  • 184
  • 335
94
votes
13 answers

Getting 'no such module' error when importing a Swift Package Manager dependency

I'm running Xcode 11 Beta 4. I'm using CocoaPods, and wanted to use one of my dependencies with Swift Package Manager as a static library instead of as a framework. On a fresh project created with Xcode 11, the dependency can be imported…
Adar Hefer
  • 1,514
  • 1
  • 12
  • 18
85
votes
13 answers

Package.resolved file is corrupted or malformed

I have a build error saying that all my SPM packages are missing. I decided to remove and re-add each package to the project, but each attempt at adding a package gives me the following error: Package.resolved file is corrupted or malformed; fix or…
Maxwell
  • 6,532
  • 4
  • 37
  • 55
81
votes
5 answers

Xcode 13.3 beta 3: "swift package init" shows warning: "~/Library/org.swift.swiftpm/collections.json has been deprecated" but dunno how to use new one

Just upgraded to Xcode 13.3 beta 3 (from Xcode 13.2.1) and ran swift package init. It generated a deprecation warning, I have not seen this before: warning: Usage of /Users/sajjon/Library/org.swift.swiftpm/collections.json has been deprecated.…
Sajjon
  • 8,938
  • 5
  • 60
  • 94
78
votes
8 answers

Xcode Workspace "Internal error: missingPackageDescriptionModule"

After updating Xcode to version 13.2 i can't build my project anymore. I have a strange error "Internal error: missingPackageDescriptionModule" related to my Workspace file. It's definitely related to SPM because Xcode is not loading SPM packages…
Peterses
  • 938
  • 7
  • 14
66
votes
7 answers

Swift Package Manager - UIKit Dependency

I have a Package.swift in my project like: import PackageDescription let package = Package( name: "ProjectName", dependencies: [ .Package(url: "https://github.com/example/repo.git", majorVersion: 0) ] ) When I run…
Onato
  • 9,916
  • 5
  • 46
  • 54
65
votes
6 answers

How to update Swift dependencies in Xcode

After I create a new swift package with dependencies I call swift package generate-xcodeproj. If my dependencies have a new version I call swift package update. The new version of my dependency gets downloaded and built but Xcode now has a bad…
joels
  • 7,249
  • 11
  • 53
  • 94
61
votes
8 answers

Generating resource_bundle_accessor, Type 'Bundle' has no member 'module'

Some times Xcode can not determine the module parameter in the Bundle. Type 'Bundle' has no member 'module' My investigations show that SPM generates an extension on the module (some times) for this property automatically in a file called…
Mojtaba Hosseini
  • 95,414
  • 31
  • 268
  • 278
59
votes
8 answers

Use resources in unit tests with Swift Package Manager

I'm trying to use a resource file in unit tests and access it with Bundle.path, but it returns nil. This call in MyProjectTests.swift returns nil: Bundle(for: type(of: self)).path(forResource: "TestAudio", ofType: "m4a") Here is my project…
Hugal31
  • 1,610
  • 1
  • 14
  • 27
51
votes
14 answers

Xcode 11 SPM authentication failed because no credentials provided

I started using Swift package manager and when I add repository with https (https://github.com/Alamofire/Alamofire.git) address authentication always fails when I try to login with my github account Xcode authentication fail But if I'm using…
Simonas Daniliauskas
  • 2,276
  • 2
  • 10
  • 15
49
votes
4 answers

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

Ran into this build error in Xcode 14.3 that prevents me from building my app. Build service could not create build operation: unknown error while handling message: MsgHandlingError(message: "unable to initiate PIF transfer session (operation in…
Flantasy Flan
  • 1,297
  • 1
  • 9
  • 8
49
votes
6 answers

How to include assets / resources in a Swift Package Manager library?

I would like to ship my library using Apple's Swift Package Manager. However my lib includes a .bundle file with several strings translated in different languages. Using cocoapods, I can include it using spec.resource. But in SwiftPM, I cannot do…
danielemm
  • 1,636
  • 1
  • 14
  • 24
47
votes
9 answers

Swift test give error "Undefined symbols for architecture x86_64"

I'm running swift test from the command line to run the test cases. This is the test case: import XCTest @testable import vnk_swift class KeyMappingTests: XCTestCase { static var allTests : [(String, (KeyMappingTests) -> () throws -> Void)] { …
Tony Dinh
  • 6,668
  • 5
  • 39
  • 58
45
votes
4 answers

How can I use Swift Package Manager (SPM) and cocoapods together in one project?

I have an existing project which uses Cocoapods, but I would like to switch to SPM; unfortunately I still have dependencies which aren't available in SPM. Now I would like to move as many dependencies as possible over to SPM and keep the others in…
swalkner
  • 16,679
  • 31
  • 123
  • 210
1
2 3
80 81