Onboard
Onboard copied to clipboard
Swift example!!
Could you please give an example in swift please? :(
// Initialize onboarding view controller
var onboardingVC = OnboardingViewController()
// Create slides
let firstPage = OnboardingContentViewController.contentWithTitle("Welcome To The App!", body: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent ut.", image: UIImage(named: "image1"), buttonText: nil, action: nil)
let secondPage = OnboardingContentViewController.contentWithTitle("Step 1", body: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent ut.", image: UIImage(named: "image2"), buttonText: nil, action: nil)
let thirdPage = OnboardingContentViewController.contentWithTitle("Step 2:", body: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent ut.", image: UIImage(named: "image3"), buttonText: nil, action: nil)
let fourthPage = OnboardingContentViewController.contentWithTitle("Step 3", body: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent ut.", image: UIImage(named: "image4"), buttonText: nil, action: nil)
// Define onboarding view controller properties
onboardingVC = OnboardingViewController.onboardWithBackgroundImage(UIImage(named: "background.jpg"), contents: [firstPage, secondPage, thirdPage, fourthPage])
onboardingVC.shouldFadeTransitions = true
onboardingVC.shouldMaskBackground = false
onboardingVC.shouldBlurBackground = false
onboardingVC.fadePageControlOnLastPage = true
onboardingVC.pageControl.pageIndicatorTintColor = UIColor.darkGrayColor()
onboardingVC.pageControl.currentPageIndicatorTintColor = UIColor.whiteColor()
onboardingVC.skipButton.setTitleColor(UIColor.blackColor(), forState: .Normal)
onboardingVC.allowSkipping = false
onboardingVC.fadeSkipButtonOnLastPage = true
// Present presentation
self.presentViewController(onboardingVC, animated: true, completion: nil)
Someone let me know if I should add this as a pull request
@rcobelli Quick question...what did you have to import and did you just put all this inside viewDidLoad in your ViewController?
I added #import "OnboardingViewController.h"
to my bridging header. Within my ViewController
, I didn't have to import anything.
All this code is within a function that I call from viewDidAppear
(where I check NSUserDefaults
)
might have to add $(PROJECT_DIR)/Pods
to your User Header Search Paths
I made an example .maybe its help link
@nazrdogan still want a swift demo .i just want a project.thx
@themachine15 I made quick example link
Swift 4
var onboardingVC = OnboardingViewController()
let firstPage = OnboardingContentViewController(title: "Page Title", body: "Page body goes here.", image: UIImage(named: "steam.png"), buttonText: "Textff For Button") { () -> Void in
// do something here when users press the button, like ask for location services permissions, register for push notifications, connect to social media, or finish the onboarding process
}
let secondPage = OnboardingContentViewController(title: "Page Title", body: "Pafqege body goes here.", image: UIImage(named: "palestine.png"), buttonText: "Tzext For Button") { () -> Void in
// do something here when users press the button, like ask for location services permissions, register for push notifications, connect to social media, or finish the onboarding process
}
onboardingVC = OnboardingViewController(backgroundImage: UIImage(named: "steam.png"), contents: [firstPage, secondPage])
onboardingVC.shouldBlurBackground = true
self.present(onboardingVC, animated: true, completion: nil)