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
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.
Make sure you have access to PSPDFKit either as a customer or by signing up for a free trial.
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
Podfile should look like this:
1 2 3 4 5 6 7 8 9 10
# Replace `YourAppName` with your app's target name. pod 'PSPDFKitSwift', :git => 'https://github.com/PSPDFKit/PSPDFKitSwift.git', :tag => '1.0.0' target :YourAppName do use_frameworks! # Replace `YOUR_COCOAPODS_KEY` with your own. pod 'PSPDFKit/Swift', podspec: 'https://customers.pspdfkit.com/cocoapods/YOUR_COCOAPODS_KEY/latest.podspec' end
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.
pod install. Afterward, you should be able to build and run your project without errors.
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:
- Open the terminal and navigate to the
You should now have
PSPDFKitSwift.framework in the Build folder. Next, add
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.
Important: Be sure to link against frameworks from the
Frameworks directory, as those are patched bundles. Compiling PSPDFKitSwift modifies
PSPDFKitUI.framework on iOS) by adding an
.apinotes file. If you copy those modified frameworks to any other Swift projects, be sure to also include PSPDFKitSwift, as the frameworks will cease to work without it.
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.
- All PSPDFKitSwift source files live in the
- PSPDFKit (and PSPDFKitUI modules on iOS) are reexported automatically.
PSPDFKitUI.apinoteson iOS) are textile files that adjust the API visibility.
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'