Swiftpack.co -  jctaoo/YuiToast as Swift Package
Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
jctaoo/YuiToast
A lightweight toast library for 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: 7
Last commit: 2 weeks ago

Ad: Job Offers

iOS Software Engineer @ Perry Street Software
Perry Street Software is Jack’d and SCRUFF. We are two of the world’s largest gay, bi, trans and queer social dating apps on iOS and Android. Our brands reach more than 20 million members worldwide so members can connect, meet and express themselves on a platform that prioritizes privacy and security. We invest heavily into SwiftUI and using Swift Packages to modularize the codebase.

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