A Swift package that provides an elegant and customizable survey interface for iOS applications using SwiftUI.
SurveyKit makes it easy to create professional-looking surveys with a modern design and smooth user experience.
- 📊 Horizontal step indicator for survey progress
- ✅ Support for single and multiple choice questions
- 🔄 Seamless navigation between questions with back/next functionality
- ✨ Automatic answer validation
- 🎯 Completion handling
- 🎨 Clean and modern UI with smooth animations
- 📱 Fully SwiftUI native
- iOS 17.0+
- Swift 6+
- Xcode 16.0+
Add SurveyKit to your project through Xcode:
- File > Add Packages
- Enter package URL:
https://github.com/Sedlacek-Solutions/SurveyKit.git
- Select version requirements
- Click Add Package
let questions = [
SurveyQuestion(
title: "How would you describe your experience?",
answers: ["Beginner", "Intermediate", "Advanced"],
isMultipleChoice: false
),
SurveyQuestion(
title: "What features interest you?",
answers: ["Analytics", "Reporting", "Sharing", "Export"],
isMultipleChoice: true
)
]
import SurveyKit
import SwiftUI
struct ContentView: View {
let questions: [SurveyQuestion] = .mock()
var body: some View {
SurveyFlow(
questions: questions,
onAnswer: { question, answers in
// Handle each question's answers
print("Question: \(question.title)")
print("Selected answers: \(answers)")
},
onCompletion: {
// Handle survey completion
print("Survey completed")
}
)
}
}
import SurveyKit
import SwiftUI
@MainActor
struct ContentScreen {
private func skipAction() {
// TODO: skip the survey
}
}
extension ContentScreen: View {
var body: some View {
NavigationStack {
SurveyFlow(questions: .mock())
.toolbar(content: toolbarContent)
}
}
@ToolbarContentBuilder
private func toolbarContent() -> some ToolbarContent {
ToolbarItem(
placement: .confirmationAction,
content: skipButton
)
}
private func skipButton() -> some View {
Button(.skip, action: skipAction)
}
}
@MainActor
extension LocalizedStringKey {
static let skip = LocalizedStringKey("Skip")
}
#Preview {
ContentScreen()
}