DEV Community

Cover image for Collect Feedback with Canny.io - #30DaysOfSwift
Vaibhav Dwivedi
Vaibhav Dwivedi

Posted on • Edited on

Collect Feedback with Canny.io - #30DaysOfSwift

Day 7: Stay in the Loop with Canny.io! 🔄

In the seventh post of #30DaysOfSwift series, I am sharing about Canny.io—a great tool for collecting user feedback and tracking feature requests.

Here’s how you can easily add Canny.io to your app:

Steps to Integrate Canny.io:

1. Set Up Your Canny.io Account:

  • If you haven’t already, sign up at Canny.io and create a new board for your app to track feedback.
  • Go to Settings > Installation and copy the Board ID you’ll need to integrate Canny.
  • Open Canny in a WebView: Since Canny operates as a web-based service, we’ll add a simple WebView to your SwiftUI app to open the feedback form.

import SwiftUI
import WebKit

struct CannyView: UIViewRepresentable {
    let urlString: String

    func makeUIView(context: Context) -> WKWebView {
        return WKWebView()
    }

    func updateUIView(_ uiView: WKWebView, context: Context) {
        if let url = URL(string: urlString) {
            let request = URLRequest(url: url)
            uiView.load(request)
        }
    }
}

struct ContentView: View {
    var body: some View {
        NavigationView {
            VStack {
                Text("Got feedback? We’d love to hear it!")
                    .padding()

                Button("Submit Feedback") {
                    // Open the Canny feedback form
                    openCannyForm()
                }
                .padding()
                .background(Color.blue)
                .foregroundColor(.white)
                .cornerRadius(10)
            }
        }
    }

    func openCannyForm() {
        if let window = UIApplication.shared.windows.first {
            let rootView = CannyView(urlString: "https://yourapp.canny.io/feedback") // Replace with your Canny feedback URL
            window.rootViewController = UIHostingController(rootView: rootView)
            window.makeKeyAndVisible()
        }
    }
}
Enter fullscreen mode Exit fullscreen mode

3. Customize Your Feedback Form:

  • Replace "https://yourapp.canny.io/feedback" with the actual URL of your Canny feedback board.
  • You can also add parameters like userID and email to pre-fill information for users who are logged in.

Happy Coding!

Top comments (0)

Sentry mobile image

Improving mobile performance, from slow screens to app start time

Based on our experience working with thousands of mobile developer teams, we developed a mobile monitoring maturity curve.

Read more

đź‘‹ Kindness is contagious

Immerse yourself in a wealth of knowledge with this piece, supported by the inclusive DEV Community—every developer, no matter where they are in their journey, is invited to contribute to our collective wisdom.

A simple “thank you” goes a long way—express your gratitude below in the comments!

Gathering insights enriches our journey on DEV and fortifies our community ties. Did you find this article valuable? Taking a moment to thank the author can have a significant impact.

Okay