OnboardingKitDemo.mp4
OnboardingKit is a SwiftUI library that provides an Apple-like app onboarding experience.
- β Swift 6.0 Compatible - Built for the latest Swift standards
- π Multi-language Support - 10 languages included out of the box
- βΏ Accessibility First - Full Dynamic Type support and accessibility features
- π¨ Highly Customizable - Flexible configuration options
- π± Cross-platform - iOS and macOS support
- π Modern SwiftUI - Uses latest SwiftUI APIs and patterns
- πΎ Automatic State Management - Built-in AppStorage integration
- π Light and Dark Mode - Fully supports both light and dark appearance
- Requirements
- Installation
- Supported Languages
- Usage
- Configuration Options
- Contributing
- License
- Author
- iOS: 18.0 or later
- macOS: 15.0 or later
- Swift: 6.0 or later
You can install OnboardingKit
using the Swift Package Manager.
- In Xcode, select "File" > "Add Package Dependencies"
- Copy & paste the following into the "Search or Enter Package URL" search bar:
https://github.com/JamesSedlacek/OnboardingKit.git
- Xcode will fetch the repository & the "OnboardingKit" library will be added to your project
OnboardingKit includes localization for the following languages:
- English (en)
- German (de)
- Spanish (es)
- French (fr)
- Italian (it)
- Japanese (ja)
- Korean (ko)
- Portuguese (pt)
- Russian (ru)
- Chinese Simplified (zh-Hans)
- Create your onboarding configuration:
import OnboardingKit
import SwiftUI
extension OnboardingConfiguration {
static let production = OnboardingConfiguration(
accentColor: .blue,
appDisplayName: "My Amazing App",
features: [
FeatureInfo(
image: Image(systemName: "star.fill"),
title: "Amazing Features",
content: "Discover powerful tools that make your life easier."
),
FeatureInfo(
image: Image(systemName: "shield.fill"),
title: "Privacy First",
content: "Your data stays private and secure on your device."
),
FeatureInfo(
image: Image(systemName: "bolt.fill"),
title: "Lightning Fast",
content: "Optimized performance for the best user experience."
)
],
titleSectionAlignment: .center
)
}
- Add onboarding to your app's root view:
import OnboardingKit
import SwiftUI
@main
struct MyApp: App {
var body: some Scene {
WindowGroup {
ContentView()
.showOnboardingIfNeeded(
config: .production,
appIcon: Image("AppIcon"),
dataPrivacyContent: {
PrivacyPolicyView()
}
)
}
}
}
You can provide a custom action to perform when the user taps "Continue":
ContentView()
.showOnboardingIfNeeded(
config: .production,
appIcon: Image("AppIcon"),
continueAction: {
// Perform analytics, API calls, etc.
Analytics.track("onboarding_completed")
// Note: Onboarding completion is handled automatically
},
dataPrivacyContent: {
PrivacyPolicyView()
}
)
Use a custom AppStorage key for tracking onboarding state:
@AppStorage("myCustomOnboardingKey") private var customOnboardingState = false
ContentView()
.showOnboardingIfNeeded(
storage: $customOnboardingState,
config: .production,
appIcon: Image("AppIcon"),
dataPrivacyContent: {
PrivacyPolicyView()
}
)
Access the convenient AppStorage extension for manual control:
import OnboardingKit
struct SettingsView: View {
@AppStorage(.onboardingKey) private var isOnboardingCompleted = false
var body: some View {
VStack {
Button("Reset Onboarding") {
isOnboardingCompleted = false
}
}
}
}
Present onboarding as a sheet above your main content, instead of replacing the root view:
import OnboardingKit
import SwiftUI
@main
struct MyApp: App {
var body: some Scene {
WindowGroup {
ContentView()
.presentOnboardingIfNeeded(
config: .production,
appIcon: Image("AppIcon"),
dataPrivacyContent: {
PrivacyPolicyView()
}
)
}
}
}
Need more than a single welcome screen? Both modifiers support a custom flow once the initial onboarding is completed, allowing you to show setup, permissions, or tutorials before marking onboarding as complete.
.showOnboardingIfNeeded(
config: .production,
appIcon: Image("AppIcon"),
dataPrivacyContent: {
PrivacyPolicyView()
},
flowContent: {
CustomTutorialView(onFinish: { /* do something */ })
}
)
accentColor
: Primary color used throughout the onboarding (default:.blue
)appDisplayName
: Your app's display name shown in the welcome sectionfeatures
: Array ofFeatureInfo
objects to showcasetitleSectionAlignment
: Horizontal alignment for the title (.leading
,.center
,.trailing
)
image
: Icon representing the feature (typically SF Symbols)title
: Brief, descriptive titlecontent
: Detailed description of the feature
We welcome contributions! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
OnboardingKit is available under the MIT license. See the LICENSE file for more info.