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:
// 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 whenfile
is set. For examplescreenshot.jpg
.file
- theData
of a file attachment like a screenshot.mimeType
- aString
value indicating the content type of the file. This is required whenfile
is set. For exampleimage/jpeg
.email
- aString
value indicating the email address of the user. When provided, this enables feedback replies via email from the Feedbackbulb Dashboard.attrs
- a dictionary ofString
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:
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:
client.debugOn()
To stop additional information being outputted, use the alternative method:
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.