# An Introduction to Swift Package Manager and how it works

DevFeed: [An Introduction to Swift Package Manager and how it works](<https://devfeed.tech/articles/an-introduction-to-swift-package-manager-and-how-it-works-24750.md>)

Original publisher: [Read original article](<https://medium.com/ymedialabs-innovation/an-introduction-to-swift-package-manager-and-how-it-works-cfe8e0d8cbd3?source=rss----8b5620c36355---4>)

Author: prateek arora

Published: 2023-04-11T05:00:35Z

Content type: tutorial

Language: en

Sources: [ymedialabs-innovation - Medium](<https://devfeed.tech/sources/ymedialabs-innovation-medium.md>)

Topics: [swift-package-manager](<https://devfeed.tech/topics/swift-package-manager.md>), [Package manager](<https://devfeed.tech/topics/package-manager.md>), [Package Management](<https://devfeed.tech/topics/package-management.md>), [Swift](<https://devfeed.tech/topics/swift.md>), [Xcode](<https://devfeed.tech/topics/xcode.md>), [Open Source](<https://devfeed.tech/topics/open-source.md>), [iOS](<https://devfeed.tech/topics/ios.md>), [Linux](<https://devfeed.tech/topics/linux.md>), [tvOS](<https://devfeed.tech/topics/tvos.md>)

Tags: [apple](<https://devfeed.tech/tags/apple.md>), [cocoapods](<https://devfeed.tech/tags/cocoapods.md>), [dependencies](<https://devfeed.tech/tags/dependencies.md>), [introduction](<https://devfeed.tech/tags/introduction.md>), [ios](<https://devfeed.tech/tags/ios.md>), [linux](<https://devfeed.tech/tags/linux.md>), [macos](<https://devfeed.tech/tags/macos.md>), [open-source](<https://devfeed.tech/tags/open-source.md>), [package-management](<https://devfeed.tech/tags/package-management.md>), [packages](<https://devfeed.tech/tags/packages.md>), [swift](<https://devfeed.tech/tags/swift.md>), [swift-package](<https://devfeed.tech/tags/swift-package.md>), [swift-package-manager](<https://devfeed.tech/tags/swift-package-manager.md>), [xcode](<https://devfeed.tech/tags/xcode.md>)

## AI overview

An introductory tutorial explains Swift Package Manager (SPM), its role in downloading, compiling, and linking Swift dependencies, and its integration with Swift. It compares SPM with third-party options such as CocoaPods and Carthage, outlines supported platforms and requirements, and describes advantages and limitations.

## Source excerpt

What is a package Manager? A package manager or package-management system is a collection of software tools that automates the process of installing, upgrading, configuring, and removing computer programs for a computer in a consistent manner. or A package manager deals with packages, distributions of software and data in archive files. Packages contain metadata, such as the software's name, description of its purpose, version number, vendor, checksum (preferably a cryptographic hash function), and a list of dependencies necessary for the software to run properly. What is Swift Package Manager (SPM) As per official Apple Swift Documentation: "The Swift Package Manager is a tool for managing the distribution of Swift code. It's integrated with the Swift build system to automate the process of downloading, compiling, and linking dependencies." The Package Manager is included in Swift 3.0 and above. Why do we need Swift Package Manager? Though we have multiple other ways to manage the dependencies like cocoa pods, Carthage etc. then why is there a need to use SPM? The answer is both cocoa pods and Carthage are third-party package managers, which eventually leads to extra code and efforts one has to put in order to utilise these third-party package managers. For example: For cocoa pods, we need to have a pod framework to be installed, which then needs ruby, gem file or brew in order to install pods. But then SPM comes inbuilt with XCode, so there won't be extra effort and extra files that will be getting added once we use SPM. System Requirement SwiftPM is compatible with macOS, iOS, tvOS and Linux For macOS, you need XCode 11 and above. For Linux, you have to install it manually or use swiftenv. Advantages SwiftPM is open-source like Cocoapods. It may be challenging or fast to contribute but it is possible. Ease of managing dependency's dependencies. If a dependency relies on another dependency, the Swift Package manager will handle it for you. Ease of resetting, manag