Your simple and lightweight SwiftUI library mate for creating beautiful onboarding screens with smooth animations and full customization options.
A real example from RaceMe! App:
- Smooth animations
- Full customization for each screen
- Optional background and object images
- Customizable action buttons with flexible actions
-
Import the
OnboardMate
library:import OnboardMate
-
Create a list of
OnboardingScreen
: EachOnboardingScreen
represents the data for one screen.Properties:
id
: Unique tab ID.backgroundImage
: Optional background image to show at the top.objectImage
: Optional object image to appear with smooth animation.primaryText
: Main title for the screen.descriptionText
: Secondary text for additional descriptions.calloutText
: Optional callout text for highlights.buttonTitle
: Action button title, default is "Get Started!".buttonColor
: Button color, default is system’s background color.didTapAction
: Action triggered when the button is tapped. Set tonil
to hide the button.
Example:
let screen1 = OnboardingScreen( id: 0, backgroundImage: Image("screen_1"), objectImage: Image("object_1"), primaryText: "Screen 1 title", descriptionText: "Screen 1 description" ) let screen2 = OnboardingScreen( id: 1, backgroundImage: Image("screen_2"), objectImage: Image("object_2"), primaryText: "Screen 2 title", descriptionText: "Screen 2 description", calloutText: "Screen 2 callout", buttonTitle: "Get Started!", buttonColor: .white ) { print("Onboarding done!") } let screensList = [screen1, screen2]
-
Display the onboarding screens: Call the
OnboardMateView
and pass your screens list.screensList
: The list ofOnboardingScreen
objects.nextButtonColor
: Optional. If set, a "Next" button will appear on screens without action buttons.
Example:
OnboardMateView(screensList: screensList, nextButtonColor: .white)
Add this to your package dependencies in Package.swift
:
dependencies: [
.package(url: "https://github.com/KirlosYousef/OnboardMate")
]
- iOS 14+
- Xcode 12+
Feel free to reach out to me at:
OnboardMate is available under the MIT License. See the LICENSE.md file for more info.
© 2024 Kirlos Yousef.