ToastPresenter is a very simple ToastMessage Presenter
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)
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
- iOS 13.0 ~
- File > Swift Packages > Add Package Dependency
- Add "https://github.com/fistDO.ToastPresenter"
ToastPresenter is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'ToastPresenter'
FirstDo, [email protected]
ToastPresenter is available under the MIT license. See the LICENSE file for more info.