# Add FeedzzieKit to your iOS app

Install the FeedzzieKit SDK with Swift Package Manager, configure your public key and show your feedback board inside your iOS app.

FeedzzieKit is the Feedzzie SDK for iOS apps. It shows your project's board as native SwiftUI screens: people read the ideas, vote, post new ones and get notified when their ideas move forward.

You need an organization and a project ([quickstart](https://docs.feedzzie.com/start/quickstart/)), and the **owner** or **admin** role: only they see **Settings › API Keys** and **Settings › Widget**.

## Requirements

- **iOS 16** or later.
- **Xcode 16** or later: the package is written in Swift 6.
- No other dependencies: FeedzzieKit brings none.

## 1. Add the package

In Xcode, choose **File › Add Package Dependencies…** and enter the repository URL:

```text
https://github.com/mikeastwoody/feedzziekit
```

Keep the dependency rule **Up to Next Minor Version** from `0.4.2`, click **Add Package**, and add the **Feedzzie** library to your app's target.

If you manage dependencies in a `Package.swift`, add it there instead:

```swift
dependencies: [
    .package(url: "https://github.com/mikeastwoody/feedzziekit", .upToNextMinor(from: "0.4.2"))
],
targets: [
    .target(
        name: "YourApp",
        dependencies: [
            .product(name: "Feedzzie", package: "feedzziekit")
        ]
    )
]
```

In your code, the module is `Feedzzie`: `import Feedzzie`.

## 2. Create a public key

The SDK identifies your project with a **public key**, which starts with `fz_pub_`.

1. In the dashboard, select the project in the header and open **Settings › API Keys**.
2. Click **Create API Key** and fill in:
   - **Key Name**: something that tells you where it is used, such as `ios-app`.
   - **Key Type**: **Public (mobile/SDK)**. The dialog names the project the key is created for: the one selected in the header.
   - **Scopes**: leave **Read**, the default. The SDK needs nothing more.
   - **Allowed bundle IDs**: optional. Empty, any app can use the key. With bundle IDs, such as `com.yourcompany.app`, only those apps can: requests from any other bundle ID are refused, your own debug builds with a different bundle ID included.
   - **Expiration**: choose **Never**. An expired key stops the board in every copy of your app already installed.
3. Copy the key. It is shown **only once**: Feedzzie keeps only a hash of it. If you lose it, create another one.

A public key is safe to ship inside your app. It reaches only the routes the SDK uses, for one project, and the REST API refuses it. Never put a secret `fz_live_` key in an app: the SDK refuses it. See [secret and public keys](https://docs.feedzzie.com/api/keys/#secret-and-public-keys).

## 3. Turn the board on

The SDK reads the same settings as the [web widget](https://docs.feedzzie.com/widget/install/). In **Settings › Widget**, for the same project:

1. Under **Widget Status**, turn on **Enable Widget**. While it is off, the board in your app cannot load.
2. Under **Permissions**, turn on **Allow Anonymous Votes** and **Allow Anonymous Submissions**. People use the board in your app without a Feedzzie account, so everything they send is anonymous. While these are off, the board shows the vote counts as plain text and has no button to post an idea.
3. Click **Save** at the bottom of the page.

**Allowed Domains** does not apply to your app: it is for web pages only.

If you turn on **Require Email**, also set `Feedzzie.config.emailField = .required` in your app, next to `configure` (step 4). Otherwise the form has no email field and every new idea is refused.

## 4. Configure the SDK at launch

Call `Feedzzie.configure(apiKey:)` once when your app starts, before it shows any Feedzzie screen:

```swift
import SwiftUI
import Feedzzie

@main
struct MyApp: App {
    init() {
        try? Feedzzie.configure(apiKey: "fz_pub_your_key")
    }

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

Replace `fz_pub_your_key` with your key. `configure` throws only when the key does not start with `fz_pub_`. It connects to `https://feedzzie.com` and, in the background, reads your board's settings from step 3.

## 5. Show the board

The board is a screen of your app: push it from your own navigation, for example from a row of your settings:

```swift
import SwiftUI
import Feedzzie

struct ContentView: View {
    var body: some View {
        NavigationStack {
            List {
                NavigationLink {
                    Feedzzie.FeedbackListView()
                } label: {
                    Label("Suggestions", systemImage: "lightbulb")
                }
            }
            .navigationTitle("Settings")
        }
    }
}
```

The board pushes each idea's detail onto the same stack, and the system's back button closes it.

If the screen you open it from has no navigation stack, present the board in a sheet instead. `FeedbackScreen` brings its own stack and a **Done** button: do not wrap it in another `NavigationStack`.

```swift
import SwiftUI
import Feedzzie

struct AboutView: View {
    @State private var showFeedback = false

    var body: some View {
        Button("Suggestions") { showFeedback = true }
            .sheet(isPresented: $showFeedback) {
                Feedzzie.FeedbackScreen()
            }
    }
}
```

In a UIKit app, present `Feedzzie.makeFeedbackViewController()` from a view controller.

Show your way into the board whenever your app has a key, whatever the network: when Feedzzie does not answer, the board shows the ideas it last loaded, and votes and ideas wait on the device until it answers.

## 6. Check that it works

Run your app and tap **Suggestions**. The board opens:

- the title **Feedback**, with a bell, the order and **My ideas** in the bar;
- the tabs **All**, **Open**, **Planned**, **In progress** and **Shipped**;
- your project's public ideas, most voted first, and a round **+** in the bottom-right corner to post an idea.

Vote for an idea and post one with **+**. A new project starts with **Require approval for new ideas** on (**Settings › Moderation**): ideas from the app wait in **Moderation** until someone approves them, and the app shows the idea as in review on the device that sent it. If you turn it off, they appear on the board and in your dashboard right away. The setting covers ideas: for now, comments from the app are published right away, whether it is on or off.

If the board cannot load, it says **Couldn't load the ideas** with the reason Feedzzie gave and **Try again**:

| The board says | What to do |
|---|---|
| `Invalid or revoked public key` | Check that `configure` gets the whole key, and that the key is still in **Settings › API Keys** |
| `Public key expired` | Create a new key with the expiration **Never** and ship it in an update of your app |
| `Widget is disabled` | Turn on **Enable Widget** and save (step 3) |
| `App bundle ID not allowed for this key` | Add your app's bundle ID to the key, or create a key without bundle IDs |

## Before you publish your app

- **Privacy.** The package includes its privacy manifest (`PrivacyInfo.xcprivacy`). Add the data the SDK sends to your App Privacy answers: the README lists it.
- **Hosts.** The SDK talks to `feedzzie.com`, and to `feedzzie.tryhazlo.app`, a second hostname of the same service, when it cannot connect to the first. Name both in your privacy policy if it lists the hosts your app talks to.
- **Languages.** The SDK's screens are translated into 12 languages, Spanish, Portuguese, Ukrainian and German among them. iOS shows a translation only for the languages your app declares in `CFBundleLocalizations` (Info.plist); otherwise the SDK shows English.

## Versions

Each FeedzzieKit release is a git tag with its number, such as `0.4.2`, and its changes are in the repository's `CHANGELOG.md`. FeedzzieKit versions follow semantic versioning. Before 1.0, a new minor version (for example 0.4 to 0.5) can include breaking changes, always listed in the `CHANGELOG.md` with upgrade notes: that is why this guide uses **Up to Next Minor Version**. Feedzzie keeps the published versions of the SDK working: a change on the server does not require you to update the SDK in your app.

To get the latest release within your rule, choose **File › Packages › Update to Latest Package Versions** in Xcode. To move to a new minor version, read its upgrade notes first, then change the rule's starting version in your app's package dependencies.

## Next steps

- [Notifications](https://docs.feedzzie.com/ios/notifications/): the board's bell, and a badge for your way into the board.
- The [FeedzzieKit README](https://github.com/mikeastwoody/feedzziekit#readme) covers everything else: the roadmap screen, opening straight to a new idea, theming, the other `Feedzzie.config` options, reporting and blocking, identifying your users and analytics events.
