ToastPresenter - A very simple ToastMessage Presenter

ToastPresenter

ToastPresenter is a very simple ToastMessage Presenter

Example

How To Use

ToastView(message: "HI! ToastPresenter is Very Simple!!", font: .preferredFont(forTextStyle: .largeTitle))
    .setImage(UIImage(systemName: "checkmark.circle.fill"))
    //.setTextColor(.white)
    //.setBackgroundColor(.black, alpha: 0.5)
    .show(in: self.view, position: .bottom(constant: 50), holdingTime: 2, fadeAnimationDuration: 2)

Functions

All the methods return ToastView, so it can be eaily chained and used declaratively

setImage(_ image: UIImage) -> ToastView

Add an image to the left of the view

setTextColor(_ color: UIColor) -> ToastView

Change text color

setBackgroundColor(_ color: UIColor, alpha: CGFloat) -> ToastView

Change backgroundColor and alpha value

show(in: UIView, position: ToastView.Position, holdingTime: TimeInterval, fadeAnimationDuration: TimeInterval)

// position: determine autolayout
// holdingTime: determine how long you want to show on the view
// fadeAnimationDuration: determine the animation time when the ToastView disappears

presentToastView on the view

Requirements

  • iOS 13.0 ~

Installation

Swift Package Manager

CocoaPods

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

pod 'ToastPresenter'

Author

FirstDo, whqtkf12@naver.com

License

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

GitHub

View Github