Latest 2.0.2
Homepage https://github.com/Kishimotovn/TDOnboarding
License MIT
Platforms ios 9.0
Frameworks UIKit
Authors

[![CI Status](https://img.shields.io/travis/Anh Phan Tran/TDOnboarding.svg?style=flat)](https://travis-ci.org/Anh Phan Tran/TDOnboarding)
Version
License
Platform

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Requirements

Installation

TDOnboarding is available through CocoaPods. To install
it, simply add the following lines to your Podfile:

pod 'TDOnboarding'

Usage

TDOnboarding lets you quickly setup a new onboarding using [TDOnboadingItem] and present the onboading.

All you need to do is provide the items and options for the onboarding through its initializer:

let onboarding = TDOnboarding(items: items, options: ExampleOnboardingOptions())
onboarding.present(from: self, completion: nil)

TDOnboardingItem

Each onboarding item must conform to the TDOnboardingItem protocol, which is defined as:

public protocol TDOnboardingItem {
    var image: UIImage { get }
    var subtitle: NSAttributedString { get }
    var topTitle: NSAttributedString? { get }
    var bottomTitle: NSAttributedString? { get }
    var topActionButtonTitle: NSAttributedString? { get }
    var bottomActionButtonTitle: NSAttributedString? { get }
}

TDOnboadingOptions

This is a protocol that lets you quickly configure the onboarding screen, it also includes default values for standard "The Distance" onboarding style, you should return nil to get defaul values. This enable easy extension to this library by adding more configurables to the enums.

The options includes:

public protocol TDOnboardingOptions {
    var defaultBackgroundImage: UIImage { get }
    var statusBarStyle: UIStatusBarStyle { get }
    var paginationCell: TDOnboardingPaginationCell.Type { get }
    func measure(for component: TDOnboardingMeasurableComponent) -> CGFloat?
    func configure(for component: TDOnboardingConfigurableComponent)
    func color(for component: TDOnboardingColorizableComponent) -> UIColor?
}

public enum TDOnboardingMeasurableComponent {
    case bottomPanelHeight
    case imageTopDistance
    case imageBottomDistance
    case bottomActionButtonWidth
}

public enum TDOnboardingColorizableComponent {
    case paginationItem
    case backgroundImageOverlay
    case bottomPanel
}

public enum TDOnboardingConfigurableComponent {
    case topActionButton(UIButton)
    case bottomActionButton(UIButton)
}

Custom Pagination View:

The library comes with default pagination view, however, you can create your own by creating and extending a collectionview cell with TDOnboardingPaginationCell

public protocol TDOnboardingPaginationCell {
    static var identifier: String { get }
    static var nib: UINib { get }
    func configure(for index: Int, isSelected: Bool, options: TDOnboardingOptions?)
}

The cell height max is 10pt.

The pagination view will automatically center the cells inside horizontally.

After that, all you need is provide the cell in the options:

struct ExampleOnboardingOptions: TDOnboardingOptions {
    ... // Other options
    var paginationCell: TDOnboardingPaginationCell.Type {
        return CustomPaginationItemCell.self
    }
}

Components with configurations

tdonboardingcomponents

Default Onboarding:

tdonboardingcomponents

Delegation:

TDOnboarding provide delegation for button actions in the onboarding screen:

...
let onboarding = TDOnboarding(items: items, options: ExampleOnboardingOptions())
onboarding.delegate = self
onboarding.present(from: self, completion: nil)
public protocol TDOnboardingDelegate: class {
    func topActionButtonTapped(on onboarding: TDOnboarding, itemIndex: Int)
    func bottomActionButtonTapped(on onboarding: TDOnboarding, itemIndex: Int)
}

Author

Anh Phan Tran, [email protected]istance.co.uk

License

TDOnboarding is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "TDOnboarding",
    "version": "2.0.2",
    "summary": "A shortcut to create TD styled onboarding with easy customization",
    "description": "TODO: Add long description of the pod here.",
    "homepage": "https://github.com/Kishimotovn/TDOnboarding",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Anh Phan Tran": "[email protected]"
    },
    "source": {
        "git": "https://github.com/Kishimotovn/TDOnboarding.git",
        "tag": "2.0.2"
    },
    "platforms": {
        "ios": "9.0"
    },
    "source_files": "TDOnboarding/**/*.swift",
    "resources": "TDOnboarding/**/*.{xib,storyboard,xcassets}",
    "frameworks": "UIKit"
}

Pin It on Pinterest

Share This