Toast Messages for iOS 9.0 and higher.
Features:
- All toasts are enqueued. One toast per time
- Customizable fonts, colors, duration and position of the message
- Different styles - Toast and notitication
- Toasts are automatically rotated
github "Serheo/ToastMessage"
pod 'ToastMessage'
- Import
import ToastMessage
- Show regular toast message
ToastManager.shared.showToastMessage(msg: "Toast Message")
- Show toast message with custom duration and location
ToastManager.shared.showToast(message: "Show second message",
duration: 3.0,
location: ToastViewLocation.bottomSpace(margin: 80))
- Show toast message with custom style
struct ToastCustomStyle: ToastViewStyle {
let backgroundColor: UIColor = UIColor.yellow
let textColor: UIColor = UIColor.black
let font: UIFont = UIFont.boldSystemFont(ofSize: 22)
}
ToastManager.shared.showToast(message: "Custom Message",
duration: 2.0,
location: ToastViewLocation.top,
style: ToastCustomStyle())
See how is looks or try it in the Demo app.
- Show regular notitication message
ToastManager.shared.showNotification(message: "Top Message")
- Show notitication message with custom style
struct NotificationCustomStyle: ToastViewStyle {
let backgroundColor: UIColor = UIColor.orange
let textColor: UIColor = UIColor.black
let font: UIFont = UIFont.systemFont(ofSize: 16.0)
}
ToastManager.shared.showNotification(message: "Custom Message",
duration: 2.0,
style: NotificationCustomStyle())
- Remove all toasts from the queue
ToastManager.shared.cancelAll()
iOS 9+ Swift
ToastMessage is available under the MIT license. See the LICENSE file for more info.