OnboardingKit is a SwiftUI package that helps you create onboarding experiences for your app. It provides a set of views that you can use to create a welcome screen, a what's new screen, and a set of onboarding screens. You can customize the views by providing your own content and colors. OnboardingKit also provides a helper class that you can use to get information about your app, such as the app name, version number, and build number.
- Swift 5.9+ (Xcode 15+)
- iOS 13+, macOS 10.15+
Install using Swift Package Manager
dependencies: [
.package(url: "https://github.com/0xWDG/OnboardingKit.git", branch: "main"),
],
targets: [
.target(name: "MyTarget", dependencies: [
.product(name: "OnboardingKit", package: "OnboardingKit"),
]),
]
And import it:
import OnboardingKit
import OnboardingKit
struct TabbarView: View {
@State
private var showWelcomeScreen = {
if UserDefaults.standard.bool(forKey: "hasSeenIntroduction") {
return false
}
return true
}()
private var features: [WelcomeCell] = [
WelcomeCell(
image: "star",
title: "Welcome",
subtitle: "To %APP_NAME%"
)
]
var body: some View {
TabView {
// Your tabview Code.
}
.sheet(isPresented: $showWelcomeScreen) {
WelcomeScreen(show: $showWelcomeScreen, items: features) {
UserDefaults.standard.setValue(true, forKey: "hasSeenIntroduction")
}
}
}
}
import OnboardingKit
struct TabbarView: View {
@State
private var showWhatsNew = { // This is to show it only on a different version
if let dictionary = Bundle.main.infoDictionary,
let dVersion = dictionary["CFBundleShortVersionString"] as? String,
let whatsNew = UserDefaults.standard.value(forKey: "whatsNew") as? String,
whatsNew == dVersion {
return false
}
return true
}()
var body: some View {
TabView {
// Your tabview Code.
}
.sheet(isPresented: $showWhatsNew) {
WhatsNew(
show: $showWhatsNew,
text: "This is new!"
) {
if let dictionary = Bundle.main.infoDictionary,
let dVersion = dictionary["CFBundleShortVersionString"] as? String {
UserDefaults.standard.setValue(dVersion, forKey: "whatsNew")
}
}
}
}
}
Key | Replacement |
---|---|
%DEVICE_APPS% |
SF Device icon with apps name (if supported, only iPad and iPhone are supported at this moment) |
%DEVICE_TYPE% |
SF Device icon name |
%APP_NAME% |
The app's name |
%APP_VERSION% |
The App's version number |
%APP_BUILD%" |
The App's build number |
We can get in touch via Twitter/X, Discord, Mastodon, Email, Website.