OnboardingViewController

@objcMembers
public final class OnboardingViewController : UIViewController

The OnboardingViewController provides a custom onboarding screen which presents some introductory screens to the user on how to get the camera in a perfect position etc. By default, three screens are pre-configured.

To allow displaying the onboarding as a transparent modal view, set the modalPresentationStyle of the container class to .OverCurrentContext. Add a blank page at the end to make it possible to “swipe away” the onboarding. To achieve this, the container class needs to implement UIScrollViewDelegate and dismiss the view when the last (empty) page is reached. With the UIScrollViewDelegate callbacks it is also possible to add a custom page control and update the current page accordingly.

Use the OnboardingPage class to quickly create custom onboarding pages in a nice consistent design. See below how easy it is to present an custom onboarding view controller.

let pages = [
    OnboardingPage(image: myOnboardingImage1, text: "My Onboarding Page 1"),
    OnboardingPage(image: myOnboardingImage2, text: "My Onboarding Page 2"),
    OnboardingPage(image: myOnboardingImage3, text: "My Onboarding Page 3")
    OnboardingPage(image: myOnboardingImage4, text: "My Onboarding Page 4")
]
let onboardingController = OnboardingViewController(pages: pages, scrollViewDelegate: self)
presentViewController(onboardingController, animated: true, completion: nil)

Note

Component API only.
  • Array of views displayed as pages inside the scroll view.

    Declaration

    Swift

    public var pages: [UIView]
  • Scroll view used to display different onboarding pages.

    Declaration

    Swift

    public lazy var scrollView: UIScrollView { get set }
  • Designated intitializer for the OnboardingViewController which allows to pass a custom set of views which will be displayed in horizontal scroll view.

    Declaration

    Swift

    public init(pages: [UIView], scrollViewDelegate: UIScrollViewDelegate?)

    Parameters

    pages

    An array of views to be displayed in the scroll view.

    scrollViewDelegate

    The receiver for the scroll view delegate callbacks.

    Return Value

    A view controller instance intended to allow the user to get a brief overview over the functionality provided by the Gini Vision Library.

  • Convenience initializer for the OnboardingViewController which will set a predefined set of views as the onboarding pages.

    Declaration

    Swift

    public convenience init(scrollViewDelegate: UIScrollViewDelegate?)

    Parameters

    scrollViewDelegate

    The receiver for the scroll view delegate callbacks.

    Return Value

    A view controller instance intended to allow the user to get a brief overview over the functionality provided by the Gini Vision Library.

  • Returns an object initialized from data in a given unarchiver.

    Warning

    Not implemented.

    Declaration

    Swift

    public required init?(coder aDecoder: NSCoder)
  • Undocumented

    Declaration

    Swift

    public override func loadView()
  • Scrolls the scroll view to the next page.

    Declaration

    Swift

    public func scrollToNextPage(_ animated: Bool)

    Parameters

    animated

    Defines whether scrolling should be animated.

  • Undocumented

    Declaration

    Swift

    public func nextPageOffset() -> CGPoint?
  • Center page in case it is not centered (i.e after rotation)

    Declaration

    Swift

    public func centerTo(page: Int)