Using PSPDFKitSwift

PSPDFKitSwift.framework is a set of wrappers and extensions that improve the Swift experience when working with PSPDFKit.


To use the Swift wrappers and extensions, you need to import the PSPDFKitSwift module:

import PSPDFKitSwift

Once this is done, you can work with the PSPDFKit framework as usual. The only change you will notice is that there are several improvements to the framework APIs when working with Swift. Check out the documentation to discover all the wrapped APIs you may want to adopt in your code.

Note: There is no need to import the PSPDFKit module separately.

Getting Started

Make sure you have access to PSPDFKit either as a customer or by signing up for a free trial.

Using CocoaPods

We assume you are familiar with CocoaPods. If not, please consult the CocoaPods documentation first.

To get a CocoaPods-based integration up and running, you need to add PSPDFKitSwift as a dependency and then modify your existing PSPDFKit integration to use the PSPDFKit/Swift subspec.

Your Podfile should look like this:

# Replace `YourAppName` with your app's target name.

pod 'PSPDFKitSwift', :git => '', :tag => '1.1.4'

target :YourAppName do

  # Replace `YOUR_COCOAPODS_KEY` with your own.
  pod 'PSPDFKit/Swift', podspec: ''

Note: PSPDFKitSwift is not published in the public CocoaPods Specs. You have to reference the pod with the Git repository, as shown in the example above. Also, make sure to replace YourAppName with your app name and YOUR_COCOAPODS_KEY with your own key provided by PSPDFKit GmbH. If you are an existing customer, you can find your key in the customer portal. Otherwise, you can request an evaluation license.

Now run pod install. Afterward, you should be able to build and run your project without errors.

Manual Setup

Note: Manual setup is only for experts, so you should know what you are doing. If you are unsure of what to do, please use CocoaPods or Carthage instead.

First, build the PSPDFKitSwift framework via the following steps:

  • Clone
  • Copy PSPDFKit.framework into PSPDFKitSwift/Frameworks.
  • Copy PSPDFKitUI.framework into PSPDFKitSwift/Frameworks.
  • Open the terminal and navigate to the PSPDFKitSwift directory.
  • Run rake compile.

You should now have PSPDFKitSwift.framework in the Build folder. Next, add PSPDFKit.framework, PSPDFKitUI.framework, and PSPDFKitSwift.framework to your project:

  • Follow the Getting Started instructions for PSPDFKit.

  • Perform the first two steps from the Integrating the Dynamic Framework section in the above Getting Started guide, and add PSPDFKitSwift to your app, similar to how you did it with PSPDFKit above. You may also want to set up your test targets accordingly. Be sure to adapt the path for the Run Script build phase for PSPDFKitSwift.

You should now be able to build and run your app.


PSPDFKitSwift is a work in progress, and we have more plans for improving upon it in the future. As such, we do not yet guarantee API stability. However, this shouldn’t stop you from using it, as changes will usually be easy to adopt.

Technical notes:

  • All PSPDFKitSwift source files live in the Sources directory.
  • PSPDFKit (and PSPDFKitUI modules on iOS) are reexported automatically.
  • PSPDFKitSwift-Private.xcodeproj is used internally by the PSPDFKit team. Always use PSPDFKitSwift.xcodeproj.

Known Issues

Linker warning when building without Carthage: In order to support Carthage out of the box with per-customer PSPDFKit URLs, we’ve added the parent Carthage build folder to Framework Search Paths. When building without Carthage, this produces the following warning:

ld: warning: directory not found for option '-F/Users/desktopuser/Projects/PSPDFKit/PSPDFKitSwift/../../../Carthage/Build/iOS'