Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add Alamofire in swift project by swift package manager [closed]

I am exploring the SPM, now I need to know how to import Alamofire via SPM in my project.

like image 249
Vignesh Avatar asked Apr 11 '17 09:04

Vignesh


People also ask

How do I add a Swift package to an existing project?

To add a new Swift package dependency: Select your project in the Project navigator, then select your app target and navigate to its General pane. Click the + button in the "Frameworks, Libraries, and Embedded Content" section, select the local package's library product, and add it as a dependency.

Is Alamofire open source?

Alamofire is an elegant, open source HTTP networking library written in Swift. It gives you an elegant interface on top of Apple's URL loading system provided by the Foundation framework.

How do I add a Swift package to Xcode project?

Open your Xcode project, navigate the File tab within the macOS bar, and click on “Add Packages”. In the Add New Package window, you can select from recently used or Apple Swift Packages. Alternatively, you can search for a package via the name or the URL to the Github page.


1 Answers

Create a .swift file named Package in your project root folder and your dependencies inside like

    import PackageDescription

    let package = Package(
        name: "YOUR_PROJECT_NAME",
        dependencies: [
        .Package(url: "https://github.com/Alamofire/Alamofire.git", majorVersion: 4)
        ]
    )

Than run swift build command in your root folder directory

like image 135
abdullahselek Avatar answered Nov 14 '22 22:11

abdullahselek