Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sedlacek-solutions/surveykit
SwiftUI Surveys
https://github.com/sedlacek-solutions/surveykit
survey swiftui
Last synced: 3 days ago
JSON representation
SwiftUI Surveys
- Host: GitHub
- URL: https://github.com/sedlacek-solutions/surveykit
- Owner: Sedlacek-Solutions
- License: mit
- Created: 2025-02-02T02:02:28.000Z (9 days ago)
- Default Branch: main
- Last Pushed: 2025-02-02T03:12:25.000Z (9 days ago)
- Last Synced: 2025-02-02T03:18:11.183Z (9 days ago)
- Topics: survey, swiftui
- Language: Swift
- Homepage:
- Size: 14.6 KB
- Stars: 2
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
![SurveyKit](https://github.com/user-attachments/assets/cba9fc77-c42c-4c9e-96c9-de7c6dabb2dd)
# SurveyKit
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.## Features
- 📊 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## Requirements
- iOS 17.0+
- Swift 6+
- Xcode 16.0+## Installation
### Swift Package Manager
Add SurveyKit to your project through Xcode:
1. File > Add Packages
2. Enter package URL: ```https://github.com/Sedlacek-Solutions/SurveyKit.git```
3. Select version requirements
4. Click Add Package## Usage
### Creating Survey Questions
```swift
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
)
]
```### Basic Implementation
```swift
import SurveyKit
import SwiftUIstruct 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")
}
)
}
}
```### Skip Button Example
```swift
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()
}
```