Adding the SDK and Rich Push Extensions

  1. With your Xcode Project open, Select Your Project → Package Dependencies → + button

    add swift package
  2. Enter Package URL: https://github.com/GoCarrot/teak-ios-framework

    Make sure Dependency Rule is set to Up to Next Major Version

    swift package config
  3. Add the Teak and TeakExtension libraries to your Application Target and click Add Package

    swift package selection
  4. Click the + button to add a new target.

    add target button
  5. Select Notification Service Extension then Next

    notification service extension
  6. Enter the product name as TeakNotificationService and click Finish

    Do not active the scheme on the dialog that is shown after clicking Finish.

    Press Don’t Activate on the Activate scheme prompt.

    add service extension
  7. Open the NotificationService file and replace its contents with

    Notification Service
    import TeakExtension
    
    class NotificationService: TeakNotificationServiceCore {
        override func serviceExtensionTimeWillExpire() {
            super.serviceExtensionTimeWillExpire()
        }
    }
    notification service code
  8. Select the TeakNotificationService target → Build PhasesLink Binary With Libraries+

    link service library
  9. Select Teak Extension and click Add

    add teak extension
  10. Click the + button to add a new target.

    add target button
  11. Select Notification Content Extension then Next

    notification content extension
  12. Enter the product name as TeakContentExtension and click Finish

    Do not active the scheme on the dialog that is shown after clicking Finish.

    Press Don’t Activate on the Activate scheme prompt.

    add content extension
  13. Open the NotificationViewController file and replace its contents with

    Notification View Controller
    import TeakExtension
    
    class NotificationViewController: TeakNotificationViewControllerCore {
        override func viewDidLoad() {
            super.viewDidLoad()
        }
    }
    notification extension code
  14. Open the Info file with an External Editor

    info external editor

    Replace its contents with

    Content Extension Info.plist
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <dict>
        <key>NSExtension</key>
        <dict>
            <key>NSExtensionAttributes</key>
            <dict>
                <key>UNNotificationExtensionCategory</key>
                <array>
                    <string>TeakNotificationContent</string>
                    <string>TeakNotificationPlayNow</string>
                    <string>TeakNotificationClaimForFree</string>
                    <string>TeakNotificationBox123</string>
                    <string>TeakNotificationGetNow</string>
                    <string>TeakNotificationBuyNow</string>
                    <string>TeakNotificationInteractiveStop</string>
                    <string>TeakNotificationLaughingEmoji</string>
                    <string>TeakNotificationThumbsUpEmoji</string>
                    <string>TeakNotificationPartyEmoji</string>
                    <string>TeakNotificationSlotEmoji</string>
                    <string>TeakNotification123</string>
                    <string>TeakNotificationFreeGiftEmoji</string>
                    <string>TeakNotificationYes</string>
                    <string>TeakNotificationYesNo</string>
                    <string>TeakNotificationAccept</string>
                    <string>TeakNotificationOkay</string>
                    <string>TeakNotificationYesPlease</string>
                    <string>TeakNotificationClaimFreeBonus</string>
                </array>
                <key>UNNotificationExtensionDefaultContentHidden</key>
                <false/>
                <key>UNNotificationExtensionInitialContentSizeRatio</key>
                <real>0.01</real>
                <key>UNNotificationExtensionUserInteractionEnabled</key>
                <true/>
            </dict>
            <key>NSExtensionPointIdentifier</key>
            <string>com.apple.usernotifications.content-extension</string>
            <key>NSExtensionPrincipalClass</key>
            <string>$(PRODUCT_MODULE_NAME).NotificationViewController</string>
        </dict>
    </dict>
    </plist>
  15. Select the TeakContentExtension target → Build PhasesLink Binary With Libraries+

    link service library
  16. Select Teak Extension and click Add

    add teak extension