Skip to content

Implementing a custom feedback form for iOS

Implement your own feedback UI

The Feedbackbulb target of the Swift package contains a simple API client which can be used to interact with the Feedbackbulb API directly.

Using this target, you're free to build your own feedback widget and submit the feedback report with the following snippet:

swift
// 1. create a client instance
var feedbackClient = FeedbackSDKClient(appKey: "XX-XXX-XXXX")

// 2. submit the content of the feedback
let _ = try await feedbackClient.submitFeedback(content: "This app is amazing! 😍")

The following optional parameters can be passed to the submitFeedback method:

  • fileName - the name of the file attachment. This is required when file is set. For example screenshot.jpg.

  • file - the Data of a file attachment like a screenshot.

  • mimeType - a String value indicating the content type of the file. This is required when file is set. For example image/jpeg.

  • email - a String value indicating the email address of the user. When provided, this enables feedback replies via email from the Feedbackbulb Dashboard.

  • attrs - a dictionary of String key-value pairs which will be attached to the feedback. This can metadata information like the app version. Do not include personal information here.

Environment attributes

We provide a helper class which offers methods to extract information about the current environment like OS and app version, device model and others:

swift
var attributes = FeedbackEnvironmentObserver().describeCurrentEnvironment()
attributes["custom"] = "some value"
...
let _ = try await client.submitFeedback(content: comment, attrs: attributes)

Debug information

The Feedbackbulb client can print additional debug information:

swift
client.debugOn()

To stop additional information being outputted, use the alternative method:

swift
client.debugOff()

All logger output from Feedbackbulb is of level debug and uses the eu.headbright.fbb.lib OSLog subsystem with a category main. You can use this as a filter in the Console app.

🚧 Work in progress