OnboardingKit is a Swift SDK that helps you create onboarding experiences in Swift and SwiftUI.
OnboardingKit is a Swift SDK that helps you create onboarding experiences in Swift
and SwiftUI
.
OnboardingKit has different onboarding types. A standard Onboarding
is shown right away, and only once, while other types can require multiple presentation attempts, a certain number of “incorrect” actions, etc.
OnboardingKit also has localized utilities, like the LocalizedOnboarding
, and UI components like OnboardingPageView
and OnboardingSlideshow
.
OnboardingKit can be installed with the Swift Package Manager:
https://github.com/danielsaidi/OnboardingKit.git
In OnboardingKit, an Onboarding
determines the state and behavior of an onboarding experience. You can use various onboarding types to get different behaviors.
The code below shows how to use a standard onboarding to present a first launch onboarding sheet:
import OnboardingKit
import SwiftUI
struct ContentView: View {
@State
private var isOnboardingPresented: Bool
private let onboarding = Onboarding(id: "welcome")
var body: some View {
Text("Hello, world")
.task(tryPresentOnboarding)
.sheet(isPresented: $isOnboardingPresented) {
...
}
}
func tryPresentOnboarding() {
onboarding.tryPresent {
isOnboardingPresented = true
}
}
}
The onboarding will honor its own rules and remember any previous presentation, so tryPresent
will only trigger when it makes sense for the onboarding.
See the online getting started guide for more information.
The online documentation has more information, articles, code examples, etc.
The Demo
folder has an app that lets you explore the library.
You can sponsor me on GitHub Sponsors or reach out for paid support, to help support my open-source projects.
Your support makes it possible for me to put more work into these projects and make them the best they can be.
Feel free to reach out if you have questions or if you want to contribute in any way:
OnboardingKit is available under the MIT license. See the LICENSE file for more info.