Add dependency via SPM or drop-in Get your credentials from Sovendus Add SDK component to your app Test integration with sandbox mode Configure production with real credentials
Step 1: Installation
Option A: Swift Package Manager (Recommended)
Add the SDK dependency to your Xcode project:
Open Xcode project
Go to File > Add Package Dependencies
Enter repository URL: https://github.com/Sovendus-GmbH/sovendus-sdk-ios
Select version and add to target
Option B: Local Drop-In
Download and drag the SovendusSDK folder into your Xcode project.
Requirements:
iOS 16.0+
Xcode 15.0+
Swift 5.7+
Step 2: Get Your Credentials
Contact Sovendus to receive:
Traffic Source Number - (e.g. 1234)
Traffic Medium Number - (e.g. 5678)
Integration Support: Contact your Sovendus representative for credentials and support.
Step 3: Add the Component
Create your SDK configuration:
let config =SovendusConfig( trafficSourceNumber:1234, trafficMediumNumber:5678, consumerData:nil, orderData:nil, sandbox:true,// Omit or set to false for production
Personalize benefits by providing consumer information:
let consumerData =ConsumerData( salutation:.mr, firstName:"Max", lastName:"Mustermann", email:"customer@example.com", country:"DE", zipCode
Privacy: Email is automatically hashed before sending. No plain text personal data leaves your app.
Step 5: Production Configuration
Configure for production deployment:
let productionConfig =SovendusConfig( trafficSourceNumber:1234,// Your real TSN from Sovendus trafficMediumNumber:5678,// Your real TMN from Sovendus consumerData: consumerData, orderData: orderData, sandbox:false,
Production Requirements:
Use real trafficSourceNumber and trafficMediumNumber from Sovendus
Set sandbox: false for production behavior
Set enableDebugLogs: false to disable debug output
Both traffic parameters are required
Step 6: Handle State Changes
Monitor component states for better UX:
privatefunchandleSovendusState(_ state:SovendusState){switch state {case.loading:// Show loading indicator if neededprint("Loading Sovendus content...")case
Step 7: Custom Link Handling (Optional)
Control how voucher and legal links are opened with a custom callback:
let config =SovendusConfig( trafficSourceNumber:1234, trafficMediumNumber:5678, consumerData: consumerData, orderData: orderData, onLinkOpened:{ url in// optional: Custom link handling - useful for:
// Create a custom font with the PostScript namelet customFont =UIFont(name:"YourCustomFont-Regular", size:14)// You can also use font descriptors for more controllet descriptor =UIFontDescriptor(name:"YourCustomFont", size:
Finding the font name: The font name used in UIFont(name:size:) is the PostScript name, which may differ from the filename. You can find it by:
Opening the font file in Font Book and checking "PostScript name" in the info panel
Printing all available fonts: UIFont.familyNames.forEach { print(UIFont.fontNames(forFamilyName: $0)) }
Example with Multiple Font Weights
// Define font helpersextensionUIFont{staticvar appFontRegular:UIFont?{UIFont(name:"Poppins-Regular", size:14)}
Default Behavior: If customFont is not provided or is nil, the SDK uses the system font.
Error Handling & Debugging
Development Mode (enableDebugLogs = true, sandbox = true)
Console logging for debugging
Network error details
Configuration validation
Sandbox benefits for testing
Production Mode (enableDebugLogs = false, sandbox = false)
Silent failures - no console spam
Graceful degradation if SDK fails
Real benefits from production API
Monitor Production Issues:
# Check device logs for production errors# Use Xcode Console or device logs# Look for SovendusSDK related messages
Common Issues:
Missing traffic numbers in production
Network connectivity issues
Invalid customer data format
Using BannerView Component
BannerView provides a compact, banner-style display of benefits that can be overlaid on your UI. It's ideal for non-intrusive benefit presentation.
Important: BannerView only starts loading data after being added to the view hierarchy. The component remains invisible until data is successfully loaded. Integrators should observe the onStateChanged callback (.success case) to control when to present or make the banner visible to users.