A simple user feedback form right into your app.
Submit user feedbacks to your own database, or use the provided Notion service to store feedbacks to a Notion database.
This is an MVP, feel free to improve it.
video.mp4
Check out the demo project.
Simply present the FeedbackForm
to the user. The form is already wrapped in a NavigationView
.
Button("Send feedback") {
showFeedbackForm = true
}
.sheet(isPresented: $showFeedbackForm) {
FeedbackForm(service: notionSubmitService)
}
You can add you own title by passing a config
parameter.
FeedbackForm(
service: notionSubmitService,
config: .init(title: "My custom title")
)
Feedbacks are submitted with using a SubmitService
.
You can define your own SubmitService
by providing a object that conforms to the protocol.
public protocol SubmitService {
func submit(formData: FeedbackFormData) async throws
}
A default implementation using Notion API is also available.
- Create a new integration on your Notion account. This service requires only insert capabilities. Save the
Internal Integration Token
for later. - On your Notion workspace, create a new full page database, with the title property beeing called
email
- Tap the "..." button on the top right of the page, then "+ Add connections". Your new connection should appear here, select it.
- In your code, instanciate a NotionSubmitService and pass it to the
FeedbackForm
View. You will need :- Your
Internal Integration Token
from the integration page. - Your database ID. To find it, copy your database link from the share button on the Notion page. The database ID is the between your user name and the fist
?
:https://www.notion.so/your-name/your-database-id?v=...
- The current notion API version. You can find it on the Notion API Documentation
- Your
let notionSubmitService = NotionSubmitService(
apiKey: "your-secret",
databaseId: "your-database-id",
notionVersion: "2022-06-28"
)