github

Ramotion / paper-onboarding

  • суббота, 7 мая 2016 г. в 03:13:01
https://github.com/Ramotion/paper-onboarding

Swift
PaperOnboarding is a material design slider



header

paper-onboarding

Twitter CocoaPods CocoaPods Travis codebeat badge

shot on dribbble:

StackViewController Example App

The iPhone mockup available here.

Requirements

  • iOS 8.0+
  • Xcode 7.3

Installation

Just add the Source folder to your project.

or use CocoaPods with Podfile:

pod 'paper-onboarding'

Usage

Storyboard

1) Create a new UIView inheriting from PaperOnboarding

2) Set itemsCount in attribute inspector

or Code

override func viewDidLoad() {
  super.viewDidLoad()

  let onboarding = PaperOnboarding(itemsCount: 3, dataSource: self)
  onboarding.translatesAutoresizingMaskIntoConstraints = false
  view.addSubview(onboarding)

  // add constratins
  for attribute: NSLayoutAttribute in [.Left, .Right, .Top, .Bottom] {
    let constraint = NSLayoutConstraint(item: onboarding,
                                        attribute: attribute,
                                        relatedBy: .Equal,
                                        toItem: view,
                                        attribute: attribute,
                                        multiplier: 1,
                                        constant: 0)
    view.addConstraint(constraint)
  }
}

For adding content use delegate methods:

func onboardingItemAtIndex(index: Int) -> OnboardingItemInfo {
   return [
     ("BIG_IMAGE1", "Title", "Description text", "IconName1", "BackgroundColor"),
     ("BIG_IMAGE2", "Title", "Description text", "IconName2", "BackgroundColor"),
     ("BIG_IMAGE2", "Title", "Description text", "IconName2", "BackgroundColor"),
   ][index]
 }

License

paper-onboarding is released under the MIT license. See LICENSE for details.

About

Maintained by app development agency Ramotion Inc. See our other open-source projects or hire us to design, develop, and grow your product.

Twitter URL Twitter Follow