I am exploring the SPM, now I need to know how to import Alamofire via SPM in my 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.
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.
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.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With