Previously, we mentioned a Rome version of Cocoapods that you can use for your Swift scripts.
Swift is moving fast, and now we have the official Swift Package Manager!.
Instead of writing a
Podfile, you write a
Package.swift, which is made up of Swift code declaring the dependencies.
Then to get the dependencies:
# If you prefer to setup with a template, including .gitignore, Sources and Tests swift package init # Generate the Xcode Project swift package generate-xcodeproj # Update swift package update # Show the dependency as a tree swift package show-dependencies
I want to highlight the use of
swift package generate-xcodeproj. This is needed so that you can write your code with an IDE. Who doesn’t love code completion.
There was a time where my generated Xcode project broke (could be due to upgrade of Xcode, or Swift Package Manager). The fix was to rerun the command.
They are constantly upgrading, and there are bounds to be changes. You will need these docs too: