Developer Docs | Kommunicate

Developer Docs | Kommunicate

  • Book a Demo
  • Try For Free

›iOS

Web

  • Installation
  • CMS Installation
  • Authentication
  • Conversation
  • Conversation Assignment
  • Customization
  • Localization
  • Logout
  • Troubleshooting

Android

  • Installation
  • Authentication
  • Push Notification
  • Conversation
  • Customization
  • Localization
  • Logout
  • Migration
  • Troubleshooting

iOS

  • Installation
  • SwiftUI Setup (Optional)
  • Authentication
  • Push Notification
  • Conversation
  • Customization
  • Configuration
  • Localization
  • Logout
  • Troubleshooting

React Native

  • Installation
  • Expo Installation
  • Authentication
  • Push Notification
  • Conversation
  • Customization
  • Logout
  • Troubleshooting

Flutter Mobile

  • Installation
  • Authentication
  • Push Notification
  • Conversation
  • Customization
  • Localization
  • Troubleshooting

Flutter Web

  • Installation
  • Authentication
  • Conversation

Ionic/Cordova

  • Installation
  • Authentication
  • Push Notification
  • Conversation
  • Customization
  • Localization
  • Logout
  • Resolving Errors

Ionic/Capacitor

  • Installation
  • Authentication
  • Push notification
  • Customization

Rich Messages

  • How To Use
  • Types of Rich Messages

Bots

  • Bot setup
  • Dialogflow Integration
  • Lex Integration
  • Kompose Bot Builder
  • IBM Watson Integration
  • Custom Bot Integration
  • Import Kompose Bot
  • Bot Samples

Integrations

  • Zapier
  • WhatsApp
  • WhatsApp 360Dialog
  • WhatsApp Twilio
  • WhatsApp Cloud API
  • Instagram Integration
  • Telegram Integration
  • Sunshine Integration
  • Freshdesk Integration
  • Pipedrive Integration
  • Agile Integration

Platform APIs

  • Authentication
  • Endpoints

Dashboard Features

  • Analytics
  • Conversations
  • Users
  • Bot Integration
  • Helpcenter
  • Campaign Messaging
  • Settings

Configuration

  • Single Sign On (SSO) Setup
  • Webhooks
  • Access Token URL
  • Email Fallback

SwiftUI Setup (Optional)

Creating an AppDelegate for Customization and Setup

To perform setup tasks such as initializing Kommunicate or handling its push notifications, you need to include an AppDelegate in your SwiftUI project.

If your project does not already include an AppDelegate, follow these steps to add and configure one.

Step 1: Create an AppDelegate.swift File

Create a new Swift file in your project and name it AppDelegate.swift.

Step 2: Add the Following Code

Paste the following implementation inside AppDelegate.swift:

import UIKit
import Kommunicate

class AppDelegate: NSObject, UIApplicationDelegate {
    func application(_ application: UIApplication,
                     didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
        // Initialize Kommunicate with your App ID
        Kommunicate.setup(applicationId: "YOUR_APP_ID") 
        return true
    }
}

Step 3: Register AppDelegate in Your SwiftUI App

In your main App struct (usually the entry point of the SwiftUI app), register the AppDelegate:

@main
struct YourApp: App {
    @UIApplicationDelegateAdaptor(AppDelegate.self) var appDelegate

    var body: some Scene {
        WindowGroup {
            ContentView()
        }
    }
}

Step 4: Add Customization Code in AppDelegate

Add your customization logic inside the AppDelegate. Here's an example:

func application(_ application: UIApplication,
                 didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {

    // Initialize Kommunicate with your App ID
    Kommunicate.setup(applicationId: "YOUR_APP_ID")

    // Customize UI settings
    Kommunicate.defaultConfiguration.hideBottomStartNewConversationButton = true

    return true
}

For more customization options, refer to the 📄 Kommunicate iOS Customization Guide.

Step 5: Setup Push Notifications (Optional)

To handle push notifications, your AppDelegate should conform to UNUserNotificationCenterDelegate and import the necessary framework:

import UserNotifications

class AppDelegate: NSObject, UIApplicationDelegate, UNUserNotificationCenterDelegate {
    // Implement required notification delegate methods here
}

Refer to the official Kommunicate documentation for push notification setup instructions: 📄 Kommunicate iOS Push Notification Guide

Tip: Using UIApplicationDelegateAdaptor allows you to maintain UIKit-style configuration and lifecycle management while still leveraging SwiftUI.

Using the Top View Controller Instead of self

When working with SwiftUI or other UIKit contexts where self (i.e., the current UIViewController) isn't directly available, you can use a utility function to retrieve the top-most view controller in your app. This is especially useful when you need to present a view controller or trigger UI-related actions.

Utility Extension

Add the following extension to retrieve the top view controller from the current window scene:

extension UIApplication {
    class func topViewController(base: UIViewController? = UIApplication.shared.connectedScenes
        .compactMap { $0 as? UIWindowScene }
        .flatMap { $0.windows }
        .first(where: { $0.isKeyWindow })?.rootViewController) -> UIViewController? {
        
        if let nav = base as? UINavigationController {
            return topViewController(base: nav.visibleViewController)
        } else if let tab = base as? UITabBarController, let selected = tab.selectedViewController {
            return topViewController(base: selected)
        } else if let presented = base?.presentedViewController {
            return topViewController(base: presented)
        }
        return base
    }
}

Example Usage

Here's how you can use this utility in a practical scenario—for instance, when integrating Kommunicate to present a conversation screen:

guard let topVC = UIApplication.topViewController() else { return }

Kommunicate.createAndShowConversation(from: topVC) { error in
    guard error == nil else {
        print("Conversation error: \(error.debugDescription)")
        return
    }
    // Success
}

Note: This approach ensures your app uses the correct top-most view controller when presenting new UI, avoiding issues with undefined or missing self in SwiftUI environments.

← InstallationAuthentication →
  • Creating an AppDelegate for Customization and Setup
    • Step 1: Create an AppDelegate.swift File
    • Step 2: Add the Following Code
    • Step 3: Register AppDelegate in Your SwiftUI App
    • Step 4: Add Customization Code in AppDelegate
    • Step 5: Setup Push Notifications (Optional)
  • Using the Top View Controller Instead of self
    • Utility Extension
    • Example Usage

Ready to automate more than 80% of your customer support?

Try for Free
  • support@kommunicate.io
  • United States
    (+1) (310) 402-2374
  • India
    (+91) 974-057-0196
  • Learn
    • iOS Chatbot
    • Amazon Lex Chatbot
    • Chatbot in Android
    • ChatGPT with Flutter
    • Document to Chatbot
    • React Native Chatbot
    • Create Flutter Chatbot
    • Whatsapp Business API
    • Integrate React Js Chatbot
    • Whatsapp Chatbot Using NodeJs
    • Integrate ChatGPT With Whatsapp
    • Integrate Dialogflow With Whatsapp
    • ChatGPT For Product Engagement
    • Product
    • AI Chatbot Builder
    • Generative AI Chatbot
    • Customer Experience
    • Chatbot Features
    • Dialogflow Integration
    • FAQ Chatbot
    • Live Chat
      Industries
    • Healthcare Chatbot
    • E-commerce Chatbot
    • Education Chatbot
    • Banking Chatbot
  • Integrations
    • E-commerce Chatbot Integration
    • Omnichannel Chatbot
    • Chatbot Integration
    • Chatbot for Website
    • Mobile Apps Chatbot
    • Chatbot for CRM's
    • Automation and Analytics
    • Zendesk Chatbot Integration
  • Resources
    • Chatbots Templates
    • Case Studies
    • Whitepapers
    • Chatbot Guide
    • Videos
    • Knowledge Hub
    • Comparisons
    • ROI Calculator
    • Blogs
    • Company
    • Partner Program
    • Affiliate Program
    • Pricing
    • About Us
    • Media
      Support
    • Contact Us
    • HelpCenter
    • Stack Overflow
    • API Status
  • Comapare
    • Kommunicate Vs Verloop
    • Kommunicate Vs Intercom
    • Kommunicate Vs Yellow
    • Kommunicate Vs Twak
    • Kommunicate Vs Ada
Arabic
Hindi
Spanish
French
German
Portuguese
Urdu
Software Advice Frontrunners for Live Chat Mar-22Software Advice Frontrunners for Live Chat Mar-22crozdesk badgeISO certificationHIPAA complianceGDPR compliant - GDPR Copy 12Created with Sketch.COMPLIANT
Copyright © 2025 Kommunicate.io.
T&C Privacy Policy Career SLA DPA Sitemap