Swiftpack.co - jctaoo/YuiToast as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by jctaoo.
jctaoo/YuiToast 0.1.1
A lightweight toast library for iOS.
⭐️ 6
🕓 2 years ago
iOS
.package(url: "https://github.com/jctaoo/YuiToast.git", from: "0.1.1")

YuiToast

A lightweight toast library for iOS.

Requirements

  • iOS 11 or any higher version.
  • Preferably Swift 5.0 or any higher version.
  • The library has not been tested with Swift 4.x or any lower version.

Features:

  • Display toast (Can contain small pictures) in one line code.
  • Modify the toast content appeared on the screen easily.

Example Project

The example project contains some usages of YuiToast. You can use and modify as your like.

Example Project Installation

Clone or download YuiToast first and run the following command:

cd YuiToast/Example
pod install

Then, open Example.xcworkspace.

Installation

CocoaPods

CocoaPods is a dependency manager for Cocoa projects. You can install it with the following command:

gem install cocoapods

To integrate YuiToast into your Xcode project using CocoaPods, specify it in your Podfile:

platform :ios, '11.0'

target 'Your Project Name' do
  use_frameworks!
  # Pods for Your Project Name
  pod 'YuiToast', '0.1.0'
end

Then, run the following command:

pod install

Usage

Show text toast:

import YuiToast

Toast.default.show(message: "Hello World")

Show toast with text and image:

import YuiToast

Toast.default.show(message: "Toast With Image", image: UIImage(named: "DemoImage"))

Set the timing of disappearance

import YuiToast

Toast.default.show(message: "Hello World", duration: .never) // never disappear
Toast.default.show(message: "Hello World", duration: .timeInterval(duration: 3)) // disappears after 3 seconds

Show any custom ToastItem

func show(_ toastItem: ToastItem)

Modify appeared Toast

import YuiToast

let item = Toast.defaut.show(...)
Toast.default.update(item: item) { item in
  item.title = "updated"
}

License

Copyright (c) 2020 Tao Juncheng

LICENSE file

GitHub

link
Stars: 6
Last commit: 2 years ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics