Skip to content

How to get started with a Swift REST API client ​

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 client = FeedbackSDKClient(
      appKey: "XX-XXX-XXXX", instanceURL: URL(string: "https://feedbackbulb.com")!)

// 2. submit the content of the feedback
let _ = try await client.reportValue(content: content)
// 1. create a client instance
var client = FeedbackSDKClient(
      appKey: "XX-XXX-XXXX", instanceURL: URL(string: "https://feedbackbulb.com")!)

// 2. submit the content of the feedback
let _ = try await client.reportValue(content: content)

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

  • 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.

Debug information ​

The FeedbackBulb client can print additional debug information:

swift
client.debugOn()
client.debugOn()

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

swift
client.debugOff()
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