Use fast package manager in existing xcode project

im new to the world of fast and xcode, so I had a problem trying to integrate the package into my project.

I want to add an Alamofire dependency with the following commands:

Inside my project root folder:

swift init 

this creates the Package.swift file, I add the dependency inside, then run:

 swift build 

Everything seems to be fine, but im my project when I try to import my library:

 import Alamofire 

I get an error message, it says that the module is not recognized. So my question is: what are the right steps to integrate the package manager and depend on an existing project without failures.

UPDATE:

 swift build 

outputs:

 Resolved version: 4.3.0 Compile Swift Module 'Alamofire' (17 sources) Compile Swift Module 'Sample' (1 sources) 

And my Package.swift:

 import PackageDescription let package = Package( name: "Sample", dependencies: [ .Package(url: "https://github.com/Alamofire/Alamofire.git", majorVersion: 4) ] ) 
+15
ios xcode swift swift-package-manager
source share
1 answer

Swift Package Manager is a standalone tool that allows you to manage dependencies and create projects without Xcode. It can generate Xcode projects for you with swift package generate-xcodeproj .

However, Swift Package Manager currently only supports project creation for MacOS and Linux. The only way to create projects for iOS, tvOS and watchOS is to use Xcode, which includes the SDKs required for these platforms.

There are ways to use Swift Packages Manager to manage dependencies for iOS / tvOS / watchOS, but this is not easy and requires manual work. If you're interested, take a look at https://github.com/j-channings/swift-package-manager-ios

In addition, I would recommend using Carthage or CocoaPods .

Update for Xcode 11

Swift Package Manager is now integrated into Xcode 11. You can add your package by choosing File, then Swift Packages, then Add Package Dependency ... Paste the repository URL in the box above and click Next. Xcode will guide you through the remaining steps. You can learn more at this WWDC talk .

+7
source share

All Articles