Skip to content

A simple toast/snackbar lib for iOS based on android material snackbar written in swift.

License

Notifications You must be signed in to change notification settings

Shubhank101/SGSnackBar

Repository files navigation

SGSnackBar

Requirements

Xcode 9.0+ and Swift 4.0

To use swift 2.0 version, please use 1.0.1 cocoapod version or swift 2 tag of the repo

Info

A android material style snackbar lib for iOS. Can be used to show as a simple toast or for more complicated operations like undo a mail delete etc. Auto dismisses after the duration you set so easy management from code point of view.

Usage

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

Show the snackbar on any view or window

self.view.showSnackbar(message: "My Snackbar message", duration: SnackbarDuration.SHORT, actionButtonText: "OK") { () -> () in
Params
message                     - Text to show in the snackbar message
duration                    - SHORT - 4 second or LONG - 7 second
actionButtonText            - optional - if set shows the action button
actionButtonClickHandler    - Swift closure that is executed when user presses the action button
UIAppearance
SGSnackBarView.appearance().actionButtonBackgroundColor
SGSnackBarView.appearance().descLabelTextColor
SGSnackBarView.appearance().snackBarBgColor
SGSnackBarView.appearance().actionButtonTextColor

All of the above can be set to display custom snackbar.

Demo

Demo

Installation

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

pod "SGSnackBar"

Author

Shubhank Gupta, [email protected]

License

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

About

A simple toast/snackbar lib for iOS based on android material snackbar written in swift.

Resources

License

Stars

Watchers

Forks

Packages

No packages published