FeddyDocs
Quickstarts

UIKit

Add Feddy to a UIKit app with Swift Package Manager and send your first message.

By the end of this page your app has a support entry point, and a message sent from it shows up in your Feddy inbox.

Prerequisites

  • A Feddy project and its project ID from Settings → Install. Create a project if you have none.
  • Xcode 15 or later. The SDK targets iOS 15 and has no third-party dependencies.

Install

In Xcode choose File → Add Package Dependencies… and paste:

https://github.com/FeddyLab/feddy-ios

Or add it to Package.swift:

.package(url: "https://github.com/FeddyLab/feddy-ios", from: "0.7.0")

Initialize

Call configure once, before any other Feddy call. Later calls are ignored.

AppDelegate.swift
import Feddy

func application(_ application: UIApplication,
                 didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
    Feddy.configure(projectId: "fd_XXXXXXXXXXXXXXXX")
    return true
}

The project ID ships inside your binary and is public by design. Commit it. Do not put it in a secrets file or an environment variable.

Add an entry point

Call present() from wherever users look for help, usually a row in Settings or a bar button item. It presents the conversation list as a sheet over the current view controller.

SettingsViewController.swift
@objc func helpTapped() {
    Feddy.present()
}

To show unread replies on the control, assign onUnreadCountChanged. It is called on the main thread whenever the count changes:

Feddy.onUnreadCountChanged = { count in
    helpItem.badgeValue = count > 0 ? "\(count)" : nil
}

Verify

Run the app, tap the control, and send a message. It appears in your Feddy inbox. Reply from the inbox; the reply shows up in the sheet and the badge shows 1 until the user reads it.

Next steps