Insider • Documentation • MIT License
This project demonstrates how to integrate the Insider iOS SDK into a Swift application using Swift Package Manager, CocoaPods, or Carthage. It includes a fully working example with push notification extensions and all major SDK features.
| Requirement | Minimum |
|---|---|
| iOS | 12.0 (SPM) / 13.0 (CocoaPods) |
| Swift | 5.3+ |
| Xcode | 14.0+ |
The project contains three build schemes, one for each dependency manager. All schemes share the same source code located in the Base/ directory.
Base/
├── AppDelegate.swift # SDK initialization & callbacks
├── SceneDelegate.swift # Deep link handling
├── NotificationService.swift # Rich push (Service Extension)
├── NotificationViewController.swift # Interactive push (Content Extension)
└── Sources/
├── Actions/ # SDK feature implementations
├── ViewControllers/ # UI
└── ...
| Scheme | Dependency Manager | Workspace |
|---|---|---|
ExampleSPM |
Swift Package Manager | Example.xcworkspace |
ExamplePods |
CocoaPods | Example.xcworkspace |
ExampleCarthage |
Carthage | Example.xcworkspace |
Each scheme has its own Notification Service and Notification Content extension targets.
git clone git@github.com:useinsider/SwiftDemo.git
cd SwiftDemoChoose one of the following methods:
Swift Package Manager
No extra steps required. Open Example.xcworkspace and select the ExampleSPM scheme. Xcode resolves packages automatically.
If you are integrating the SDK into your own project, add the package in Xcode as follows:
-
Go to File → Add Package Dependencies...
-
Enter the repository URL:
https://github.com/useinsider/Insider-iOS-SDK -
Select your project under Add to Project and click Add Package.
Important: When adding the Insider-iOS-SDK package, you must add all SDKs (including
InsiderMobileAdvancedNotification) to the main app target (e.g.ExampleSPM), not to the service or content extension targets.![]()
CocoaPods
pod installOpen Example.xcworkspace and select the ExamplePods scheme.
The Podfile includes:
platform :ios, '13.0'
use_frameworks!
target 'ExamplePods' do
pod 'InsiderMobile'
pod 'InsiderGeofence'
pod 'InsiderWebView'
end
target 'InsiderNotificationServicePods' do
pod 'InsiderMobileAdvancedNotification'
end
target 'InsiderNotificationContentPods' do
pod 'InsiderMobileAdvancedNotification'
endCarthage
carthage update --use-xcframeworks --platform iOSOpen Example.xcworkspace and select the ExampleCarthage scheme.
The Cartfile includes:
binary "https://mobilesdk.useinsider.com/carthage/InsiderWebView/1.0.0/InsiderWebView.json"
binary "https://mobilesdk.useinsider.com/carthage/InsiderGeofence/1.2.4/InsiderGeofence.json"
binary "https://mobilesdk.useinsider.com/carthage/InsiderMobile/14.3.1/InsiderMobile.json"
binary "InsiderMobileAdvancedNotification.json"
After building, link the frameworks from Carthage/Build/ in your target's Frameworks, Libraries, and Embedded Content section.
Before running, update the following values with your own:
- Partner Name in
Base/AppDelegate.swift:
Insider.initWithLaunchOptions(
nil,
partnerName: "YOUR_PARTNER_NAME",
appGroup: "YOUR_APP_GROUP"
)-
App Group identifier in all three files:
Base/AppDelegate.swiftBase/NotificationService.swiftBase/NotificationViewController.swift
-
Signing & Capabilities for every target (app + both extensions):
- Set your development team
- Enable Push Notifications
- Add an App Groups capability with the same identifier used above
- Enable Background Modes: Remote notifications, Location updates, Background processing
Important: The App Group identifier must be identical across the main app target and both notification extension targets.
Verify that the
com.apple.security.application-groupsvalue in each target's.entitlementsfile matches theappGroupparameter passed toInsider.initWithLaunchOptions.A mismatch will prevent the SDK from sharing data between the app and its extensions.
- URL Scheme: In target's Info tab under URL Types, set the scheme to match your partner name (e.g.,
insideryourpartnername).
The SDK is initialized in AppDelegate.swift:
import InsiderMobile
import InsiderGeofence
import InsiderWebView
@main
public final class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterDelegate {
public func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
UNUserNotificationCenter.current().delegate = self
// Register callback handler for SDK events
Insider.registerCallback(with: #selector(insiderCallback(_:)), sender: self)
// Initialize with your partner name and app group
Insider.initWithLaunchOptions(nil, partnerName: "YOUR_PARTNER_NAME", appGroup: "YOUR_APP_GROUP")
// Show push notifications while app is in foreground
Insider.setActiveForegroundPushView()
return true
}
}Deep links are handled in SceneDelegate.swift:
import InsiderMobile
public final class SceneDelegate: UIResponder, UIWindowSceneDelegate {
public var window: UIWindow?
public func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
guard let _ = (scene as? UIWindowScene) else { return }
for urlContext in connectionOptions.urlContexts {
Insider.handle(urlContext.url)
}
}
}@objc public func insiderCallback(_ dict: [String: Any]) {
if let typeAsInt = dict["type"] as? Int,
let type = InsiderCallbackType(rawValue: typeAsInt) {
switch type {
case .notificationOpen:
// Handle push notification tap
break
case .inAppSeen:
// Handle in-app message impression
break
case .inappButtonClick:
// Handle in-app button interaction
break
case .sessionStarted:
// Handle session start
break
case .tempStoreAddedToCart, .tempStorePurchase, .tempStoreCustomAction:
// Handle e-commerce events
break
}
}
}The SDK requires two notification extensions for full push notification support:
- Notification Service Extension — Intercepts incoming push notifications to download rich media (images, videos) before display. See
Base/NotificationService.swift. - Notification Content Extension — Provides an interactive carousel UI for expanded push notifications. See
Base/NotificationViewController.swift.
Both extensions must share the same App Group identifier as the main app target. Refer to the source files for the complete implementation.
The Notification Content Extension's Info.plist must include the following entries:
<key>NSExtension</key>
<dict>
<key>NSExtensionAttributes</key>
<dict>
<key>UNNotificationExtensionCategory</key>
<string>insider_int_push</string>
<key>UNNotificationExtensionDefaultContentHidden</key>
<false/>
<key>UNNotificationExtensionInitialContentSizeRatio</key>
<real>0.5</real>
</dict>
<key>NSExtensionMainStoryboard</key>
<string>InsiderInterface</string>
<key>NSExtensionPointIdentifier</key>
<string>com.apple.usernotifications.content-extension</string>
</dict>CocoaPods copies InsiderInterface.storyboard from the SDK into your build automatically. However, the storyboard's view controller does not have a Module set by default, which means the NotificationViewController class will not be resolved at runtime.
After running pod install, you need to configure it manually:
-
Open
Pods/InsiderMobileAdvancedNotification/Resources/InsiderInterface.storyboardin Xcode:
-
Select the Notification View Controller scene.
-
In the Identity Inspector, set:
- Class:
NotificationViewController - Module: Your Notification Content Extension target name (e.g.
InsiderNotificationContentPods) - Keep Inherit Module From Target unchecked
- Class:
Important: Running
pod installmay reset the storyboard to its original state. You may need to re-apply this change after eachpod install.
Unlike CocoaPods, SPM and Carthage do not automatically provide the InsiderInterface.storyboard file. You need to create it manually in your Notification Content Extension target.
Copy the InsiderInterface.storyboard from this project (e.g. InsiderNotificationContentSPM/InsiderInterface.storyboard) into your Notification Content Extension target, then open it in Xcode and check the Inherit Module From Target box field in the Identity Inspector to match your target name.
This project is licensed under the MIT License. See the LICENSE file for details.

