SwiftUI

Let's say you're using new and shiny SwiftUI but don't know if you can use HelpCrunch with it...
Written by Andrew
Updated 2 years ago

You can easily add the HelpCrunch SDK to your SwiftUI app!

First of all, you should check if you have AppDelegate.swift. If not, just follow these simple steps:

Adding AppDelegate

Create the AppDelegate.swift file:

import UIKit
import HelpCrunchSDK

class AppDelegate: NSObject, UIApplicationDelegate {
    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
 
        return true
    }
}

You can now add to it the configuration and initialisation from the article: Add the HelpCrunch iOS SDK to your app. And if you need pushes, check this article: Set up notifications in the iOS SDK

Use in code

Now you can easily call the HelpCrunch SDK via code by calling showFrom:nil. Here is an example of how to call the SDK from a simple button:

Button("HelpCrunch!") {
    HelpCrunch.show(from: nil) { error in
        print("SDK is on the screen")
    }
}
Did this answer your question?