Day 7: Stay in the Loop with Canny.io! 🔄
In the seventh post of the #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:
Settings > Installation
, and copy the Board ID you’ll need to integrate Canny.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()
}
}
}
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!