How to use Swift Package Manager

What is Swift Package?

According to Apple’s doc:

For developers, Swift Package has the native support from Apple, which is recommended way of using 3rd libraries.

How to use

Go to FileSwift PackageAdd Package Dependency:

Add Swift Package URL:

Then it will ask you to confirm with the versions, keep it default.

Then it will prompt to ask for which target you want to use, in my case. Choose the main target in most of the time, but in my case it is UITesting.

Then we are able to use the library. Sometimes we need to compile, build or run test to let the Xcode to recognize the libraries we just added.

We can also update the library by selecting [Target] Build Phrase → Link Binary With Libraries:

We can add and remove any Swift Package Library to any targets in the project.

Reference

Originally published at https://needone.app on October 30, 2020.

--

--

--

needone.app

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

How to Change Watch Orientation on APPLE Watch Nike Series 7

Saving your app from App Store Rejection

Everything You Need to Know About iOS 14 Widgets

@IBDesignable in UIKit

Authoring Swift PlaygroundBooks — part 3

Advanced iOS Emulators for PC

Add tokens with Apollo iOS client (GraphQL)

Objective-C: Does Learning from the fourth edition of the book Objective-C for Absolute Beginners…

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Needone App

Needone App

needone.app

More from Medium

ASync await feature for http requests and running tasks in parallel with TaskGroup in Swift

How To Implement a Custom MapKit Callout in iOS

A map

Use a Swift command-line tool in a GitHub workflow

Swift | MutltiformData | Upload Videos to Server as a Multipart form data Using Alamofire