An easy way to present customizable bottom-half alert.
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).
- Swift 3.x: >= 1.0.1 Download here.
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
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()