iOS SDK Integration
Add Helplane chat support to your iOS app using our native SDK.
Requirements
- iOS 14.0 or later
- Swift 5.5 or later
- Xcode 13 or later
Installation
Swift Package Manager (Recommended)
- In Xcode, go to File > Add Package Dependencies
- Enter the repository URL:
https://github.com/intigratech/helplane-ios-sdk.git
- Select the version and click Add Package
CocoaPods
Add to your Podfile:
pod 'HelpLaneSDK', :git => 'https://github.com/intigratech/helplane-ios-sdk.git'Then run:
pod installConfiguration
Initialize the SDK
In your AppDelegate.swift or app entry point:
import HelpLaneSDK@main
class AppDelegate: UIResponder, UIApplicationDelegate {
func application(_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
HelpLane.configure(brandToken: "your-brand-token")
return true
}
}
Identify Users (Optional)
For logged-in users, identify them to maintain conversation history:
let user = HelpLaneUser(
externalId: "user-123",
name: "John Doe",
email: "[email protected]",
avatarURL: "https://example.com/avatar.jpg",
customAttributes: ["plan": "premium", "company": "Acme Inc"]
)HelpLane.setUser(user)
Displaying the Chat
Present Chat Modal
import HelpLaneSDKclass SupportViewController: UIViewController {
@IBAction func openChat(_ sender: Any) {
HelpLane.present(from: self)
}
}
Embed Chat View
import HelpLaneSDKclass ChatContainerViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
let chatVC = HelpLaneChatViewController()
addChild(chatVC)
view.addSubview(chatVC.view)
chatVC.view.frame = view.bounds
chatVC.didMove(toParent: self)
}
}
SwiftUI Integration
import SwiftUI
import HelpLaneSDKstruct ContentView: View {
@State private var showChat = false
var body: some View {
Button("Get Help") {
showChat = true
}
.sheet(isPresented: $showChat) {
HelpLaneChatViewRepresentable()
}
}
}
struct HelpLaneChatViewRepresentable: UIViewControllerRepresentable {
func makeUIViewController(context: Context) -> HelpLaneChatViewController {
return HelpLaneChatViewController()
}
func updateUIViewController(_ uiViewController: HelpLaneChatViewController, context: Context) {}
}
User Logout
When users log out, clear their identity:
HelpLane.clearUser()Customization
The chat widget inherits your brand colors and styling configured in your Helplane dashboard under Settings > Chat Widget.