CocoaPods is a popular dependency manager for Swift and Objective-C projects, and you can use it to integrate PSPDFKit into your project. Using CocoaPods is easier than manually adding the PSPDFKit frameworks to your project.
CocoaPods is available as a Ruby gem you can install by running
gem install cocoapods. Using the default Ruby available on macOS can require you to use
sudo when installing CocoaPods:
sudo gem install cocoapods. To avoid this, we recommend using a Ruby version manager like
To begin integration, first create a
Podfile next to your Xcode project by running
pod init. A
Podfile describes the dependencies of the targets of your Xcode project. The content of your
Podfile should look like this (change
YourTargetName to the target of your app):
use_frameworks! target :YourTargetName do pod 'PSPDFKit', podspec: 'https://customers.pspdfkit.com/pspdfkit-ios/latest.podspec' end
Now you can run
pod install in the directory of your
Podfile to install all new pods. This will download PSPDFKit and integrate it into your project. It will also create a new Xcode workspace that you will have to use in place of the original Xcode project.
Open the newly created Xcode workspace and import both
PSPDFKitUI into any of your source files:
import PSPDFKit import PSPDFKitUI
@import PSPDFKit; @import PSPDFKitUI;
Build and run your target. That’s it! PSPDFKit has been successfully integrated into your project.
You can start by presenting a PDF onscreen or checking out our API and documentation guides. To learn more about CocoaPods, take a look at the official CocoaPods documentation and read our Integrating PSPDFKit Using CocoaPods guide. Feel free to reach out to us if you run into any problems or have questions. We’re happy to help!