This document provides context for AI assistants and developers working on this project.
CeedAdsIOSSample serves as:
- SDK Test Application: Primary test bed for validating ceed-ads-ios-sdk functionality
- Integration Reference: Demonstrates best practices for SDK integration in SwiftUI apps
- Demo Tool: Showcases ad delivery in conversational AI contexts to stakeholders
This sample app depends on the CeedAdsSDK Swift package. The SDK provides:
CeedAdsSDK.initialize(appId:)- SDK initializationCeedAdsSDK.requestAd(conversationId:messageId:contextText:)- Ad request APIResolvedAd- Ad data model with format-specific configurationsCeedAdsView- Unified view that auto-selects the appropriate formatCeedAdsActionCardView- Traditional action card displayCeedAdsLeadGenView- Email capture formCeedAdsStaticView- Banner-style displayCeedAdsFollowupView- Engagement card with selectable options
Important: The SDK is a separate package. Changes to ad logic, ad formats, or API endpoints are made in the SDK repository, not here.
| Feature | Status | Notes |
|---|---|---|
| SDK Initialization | ✅ | test-app ID for testing |
| Ad Request (Text Context) | ✅ | Uses conversation text as context |
| Action Card Display | ✅ | Uses CeedAdsView (unified) |
| Lead Gen Display | ✅ | Email capture form with validation |
| Static Ad Display | ✅ | Banner-style with optional image |
| Followup Display | ✅ | Selectable options with feedback |
| Multi-turn Conversation | ✅ | 7 scenario types available |
| Typing Indicator | ✅ | Animated dots |
| Dark Mode Support | ✅ | Adaptive colors (dark theme default) |
| Format | Trigger Keywords | Purpose |
|---|---|---|
| Action Card | "tech", "language", etc. | Traditional CTA cards |
| Lead Gen | "newsletter", "subscribe", "updates" | Email capture testing |
| Static | "event", "promotion", "deal" | Banner display testing |
| Followup | "feedback", "survey", "opinion" | Option selection testing |
| Feature | Status | Notes |
|---|---|---|
| Video Ads | Under consideration | Not yet in SDK |
| Native Ads | Under consideration | Not yet in SDK |
The app uses predefined scenarios (see ScenarioData.swift) to ensure consistent testing:
- Trigger: Keywords like "communicating", "another", "language"
- Purpose: Tests ad matching for language learning products
- Final context: "AI English conversation app"
- Trigger: Keyword "tech"
- Purpose: Tests ad matching for coding courses
- Final context: "AI coding course"
- Trigger: Default fallback (no English keywords detected)
- Purpose: Tests Japanese language ad matching
- Final context: Same as English but in Japanese
- Trigger: Keywords like "off", "places", "refreshing"
- Purpose: Tests ad matching for travel services
- Final context: "nice hotel"
- Trigger: "newsletter", "subscribe", "updates"
- Purpose: Tests lead_gen format with email capture
- Expected Ad Format:
CeedAdsLeadGenView - Events Tested: impression, submit
- Trigger: "event", "promotion", "deal"
- Purpose: Tests static format with banner display
- Expected Ad Format:
CeedAdsStaticView - Events Tested: impression, click
- Trigger: "feedback", "survey", "opinion"
- Purpose: Tests followup format with selectable options
- Expected Ad Format:
CeedAdsFollowupView - Events Tested: impression, optionTap
Rather than free-form conversation, we use scenarios because:
- Reproducibility: Same input always produces same conversation flow
- Testing: Easier to verify ad matching with known final context
- Demo reliability: Stakeholder demos work consistently
- Modern iOS development standard
- Better support for reactive UI updates
- Cleaner integration with async/await patterns
- Simpler than ObservableObject + @Published
- Better performance (fine-grained updates)
- Cleaner syntax
-
Define the scenario messages in
ScenarioData.swift:let newScenario: [ScenarioMessage] = [ ScenarioMessage(role: .user, text: "..."), ScenarioMessage(role: .ai, text: "..."), // ... alternating user/ai messages ]
-
Add to
ScenarioTypeenum:enum ScenarioType: String { // ... existing cases case newScenario }
-
Add trigger keywords in
scenarioDetectionKeywords:ScenarioKeyword(scenario: .newScenario, keywords: ["trigger", "words"]),
-
Register in
scenarioTable:.newScenario: newScenario,
The ad content returned depends on the backend ad server configuration. To test different ads:
- Modify the
contextTextparameter in ad requests - Ensure backend has ads configured for the test context
- Check Network debugging for request/response details
| Issue | Cause | Solution |
|---|---|---|
| No ads appearing | Backend not configured | Check ad server has test ads |
| SDK init failure | Invalid app ID | Use "test-app" for development |
| Scenario not triggering | Keywords not in message | Check scenarioDetectionKeywords |
- Integrated new ad formats support using
CeedAdsView(unified view) - Added 3 new test scenarios: leadGen, staticAd, followup
- Updated ChatView to use unified view with callbacks
- Updated fallback message to include new scenario options
- Created initial README.md and CONTEXT.md documentation
- Project structure documented for future development
- Chat interface implemented with scenario-based conversations
- CeedAdsSDK integration completed
- Dark mode support added
- Initial project creation
- Basic SwiftUI app scaffold