Giter Site home page Giter Site logo

toastmessage's Introduction

Toast Message

Build Swift CocoaPods Compatible Carthage compatible

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

Installation

Carthage

github "Serheo/ToastMessage"

CocoaPods

pod 'ToastMessage'

Getting Started

  • 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. Toast screenshot

  • 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()

Notification screenshot

Requirements

iOS 9+ Swift

License

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.