OnboardingKit

0.0.3

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.
0xWDG/OnboardingKit

What's New

0.0.3

2024-06-21T15:06:39Z

Make What's New public

OnboardingKit

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 Package Manager License

Requirements

  • Swift 5.9+ (Xcode 15+)
  • iOS 13+, macOS 10.15+

Installation

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

Welcome View Usage

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")
            }
        }
    }
}

What's New View Usage

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!"
            )
        }
    }
}

Contact

We can get in touch via Twitter/X, Discord, Mastodon, Email, Website.

Description

  • Swift Tools 5.9.0
View More Packages from this Author

Dependencies

  • None
Last updated: Sat Nov 16 2024 20:15:19 GMT-1000 (Hawaii-Aleutian Standard Time)