Swift Package Manager

We support integrating Shake into your Xcode project using Swift Package Manager.

Installing the Shake Package

Select FileSwift PackagesAdd Package Dependency

Enter the Shake repository url when prompted:

https://github.com/shakebugs/shake-ios

Choose the appropriate cloning details and optionally specify the exact Shake version or branch.

Click Finish to add the Shake package to your project.

Add Client ID and Secret to Info.plist

Open your project or workspace and in the Project Navigator, right click on Info.plist, and Open as › Source code. Paste this but replace your-api-client-id and your-api-client-secret with the actual values you have in your workspace settings:

Info.plist
<?xml version="1.0" encoding="utf-8" ?>
<plist version="1.0">
<dict>
<key>Shake</key>
<dict>
<key>APIClientID</key>
<string>your-api-client-id</string>
<key>APIClientSecret</key>
<string>your-api-client-secret</string>
</dict>
</dict>
</plist>

Initialize Shake SDK

AppDelegate.swift
import UIKit
import Shake
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
Shake.start()
return true
}
}

Now select Product › Run in the menu bar. This first run will automatically add your app to your Shake Dashboard based on your app bundle ID.

note

Shake is distributed as a binary framework. There is a known issue with SPM signing the binary packages which will pop up when running your app on the real device. The issue has been fixed in the Xcode Version 12.2 beta 3.

Temporary workaround

Select your app target, and add a new Copy Files phase to the Build Phases. Make sure to change the destination to Frameworks folder.

Add a new Run Script phase and paste the following script to force the deep signing of frameworks with your own identity.

find "${CODESIGNING_FOLDER_PATH}" -name '*.framework' -print0 | while read -d $'\0' framework
do
codesign --force --deep --sign "${EXPANDED_CODE_SIGN_IDENTITY}" --preserve-metadata=identifier,entitlements --timestamp=none "${framework}"
done