Skip to content

Provides Android-like API for displaying toasts

License

Notifications You must be signed in to change notification settings

RomuloVitoi/SimpleToast

 
 

Repository files navigation

SimpleToast

Provides Android-like API for displaying toasts with keyboard aware positioning on iOS.

Toast

Installation

Through CocoaPods:

Swift 2:

pod 'SimpleToast', :git => 'https://github.com/RomuloVitoi/SimpleToast.git', :commit => '93be63ba14897de5fa5654eb0119bcd5e502de59'

Swift 3.0:

pod 'SimpleToast', :git => 'https://github.com/RomuloVitoi/SimpleToast.git', :commit => '37afacad1743dadfb4d870cf544580c1fa14a767'

Usage

First you need to initialize the keyboard observer somewhere. It doesn't really matter where.

import SimpleToast

...

Toast.initKeyboardObserver()

...

Then use just use it as follows (with the library imported):

Toast.makeText("My toast message", Toast.LENGTH_LONG).show()

Settings

There's a few appearance settings you can adjust:

blur: Bool

Right there's no background at all if you turn this of. To be fixed...

blurStyle: UIBlurEffectStyle

cornerRadius: CGFloat

margin: CGFloat

Margin to parent view (ie. the window)

padding: CGFloat

Padding between the background view and the text label.

textColor: UIColor

animationDuration: NSTimeInterval

Example:

Set the values like so:

Toast.appearance.cornerRadius = 2

License

MIT Licensed

About

Provides Android-like API for displaying toasts

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Swift 93.5%
  • Ruby 3.3%
  • Objective-C 3.2%