Skip to content

Latest commit

 

History

History
65 lines (51 loc) · 2.74 KB

README.md

File metadata and controls

65 lines (51 loc) · 2.74 KB

FeedbacksKit

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.

Media

video.mp4

Usage

Check out the demo project.

View

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")
)

Submission

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.

How to use the NotionSubmitService.

  • 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

Screenshot 2023-03-04 at 16 31 38

  • Tap the "..." button on the top right of the page, then "+ Add connections". Your new connection should appear here, select it.

Screenshot 2023-03-04 at 16 34 12

  • 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
let notionSubmitService = NotionSubmitService(
    apiKey: "your-secret",
    databaseId: "your-database-id",
    notionVersion: "2022-06-28"
)