pmusolino / SnackView

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SnackView logo

SnackView

An easy way to present customizable bottom-half alert. SnackView logo

CocoaPods Compatible Platform License Twitter

Installation with CocoaPods

CocoaPods is a dependency manager for Objective-C, which automates and simplifies the process of using 3rd-party libraries like SnackView in your projects. You can install it with the following command:

$ gem install cocoapods

CocoaPods 1.0.1+ is required to build SnackView 1+ (along with Swift 3 and Xcode 9).

Podfile

To integrate SnackView into your Xcode project using CocoaPods, specify it in your Podfile:

use_frameworks!
pod 'SnackView', '~> 1.0.2'

Then, run the following command:

$ pod install

Create your custom SnackView alert

SnackView includes some default UI elements as Button, Label and other complex UI. The first step is to create an array of SVItem. SVItem is the class of every element that SnackView can include within it.

Here an example of simple SnackView alert:

//SVItem array
let items: Array<SVItem>!

//Define all the view you want to display
let newPassword = SVTextFieldItem(withPlaceholder: "New Password", isSecureField: true)
        
let repeatPassword = SVTextFieldItem(withPlaceholder: "Repeat Password", isSecureField: true)
        
let continueButton = SVButtonItem(withTitle: "Continue") {
    /* Handle action here */
}
        
//Populate the SVItem array
items = [newPassword, repeatPassword, continueButton]

//Present the alert on screen.
SnackView(withTitle: "Create password", andCloseButtonTitle: "Cancel", andItems: items).show()

SnackView alert

About

License:Apache License 2.0


Languages

Language:Swift 83.3%Language:Ruby 15.4%Language:Objective-C 1.2%