WelcomeViewController 2.0.0

WelcomeViewController 2.0.0

Maintained by Dan Loewenherz.



 
Depends on:
SuperLayout~> 2.0
LionheartExtensions~> 5.0
 

A welcome view in the style of Apple's built-in apps.

CI Status Version License Platform Swift

Example

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

Usage

Create an enum with all of the features you'd like to summarize:

enum WelcomeItem {
    case library
    case watchNow
    case store
}

Make the enum conform to WelcomeCardProvider.

extension WelcomeItem: WelcomeCardProvider {
    var title: String {
        switch self {
        case .library: return "Library"
        case .watchNow: return "Watch Now"
        case .store: return "Store"
        }
    }

    var description: String {
        switch self {
        case .library: return "Find your purchases and rentals in one convenient place."
        case .watchNow: return "Start watching the TV shows and mvoies you love from all your supported apps."
        case .store: return "Get supported apps, discover new movie releases, and find popular TV shows."
        }
    }

    var imageName: String? {
        switch self {
        case .library: return "Categories"
        case .watchNow: return "Preview"
        case .store: return "Check"
        }
    }

    var color: UIColor? {
        return UIColor(.RGB(37, 185, 255))
    }
}

Lastly, instantiate WelcomeViewController:

let controller = WelcomeViewController<WelcomeItem>(header: "Welcome to the TV app.", buttonText: "Continue", callouts: [.library, .watchNow, .store], delegate: nil)

To attach an action when someone taps the button, set the delegate to an object conforming to WelcomeViewControllerDelegate.

extension MyViewController: WelcomeViewControllerDelegate {
    func welcomeViewControllerButtonDidTouchUpInside(_ sender: Any) {
        dismiss(animated: true)
    }
}

Installation

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

pod 'WelcomeViewController'

Author

Dan Loewenherz

License

WelcomeViewController is available under the Apache 2.0 license. See the LICENSE file for more info.