MotionToastView 0.1.10

MotionToastView 0.1.10

Sameer Nawaz维护。



MotionToastView - 一个精美的iOS Swift Toast库

CI Status Version License Platform

一个使用Swift在iOS中构建的美丽多用途Toast库😍

GitHub Cards Preview

预览 - 亮色调Toast🌈

gif

预览 - 浅色调Toast🌟

gif

预览 - 深色亮色调Toast🌈

gif

预览 - 深色浅色调Toast🌈

gif

Toast样式类型❤️

1. 浅色Toast 2. 生动Toast 3. 深色浅色Toast 4. 深色生动Toast

关于

使用Swift在iOS中实现的美观的多功能动态Toast视图,具有完全的自定义选项。该库使用Swift 5开发。

示例

要运行示例项目,请首先克隆存储库,然后在示例目录中运行 pod install

安装

MotionToastView通过CocoaPods提供。要安装,只需将以下行添加到您的Podfile中。

pod 'MotionToastView'

在您的类中导入MotionToastView

import MotionToastView

4️⃣Toast类型

        1 .success
        2 .error
        3 .warning
        4 .info

✌🏻 Toast样式

        1 .style_vibrant
        2 .style_pale

⌛️Toast持续时间

        1 .short 	// 2 Seconds
        2 .long 	// 4 Seconds

使用方法

运动toast视图示例代码🌟

成功toast

(基本)

MotionToast(message: "You have successfully completed the trip", toastType: .success)             

错误toast

(带圆角)

MotionToast(message: "You have failed to complete the trip", toastType: .error, toastCornerRadius: 12)

警告toast

(带有持续时间、样式、重力、脉动效果)

MotionToast(message: "You are not in the location. Try again", toastType: .warning, duration: .long, 
              toastStyle: .style_pale, toastGravity: .centre, pulseEffect: false)     

信息toast

(带有持续时间、样式、重力)

MotionToast(message: "You have failed to complete the trip", toastType: .info, 
              duration: .long, toastStyle: .style_pale, toastGravity: .top)

备注

浅色和深色模式通过系统偏好设置设置

toastCornerRadius 参数仅适用于 vibrant 样式的 Toast

动态 Toast 视图

参数 可选 默认值 类型 可用的值
message false nil 字符串 自定义
toastType false nil 枚举 [.success, .error, .warning, .info]
duration true .short 枚举 [.short, .long]
toastStyle true .style_vibrant 枚举 [.style_vibrant, .style_pale]
toastGravity true .bottom 枚举 [.top, .centre, .bottom]
toastCornerRadius true 0 整型 自定义
pulseEffect true true 布尔型 [true, false]

💄 需要更多自定义吗?

MotionToast_Customisation(header: "Custom Toast", message: "It gives you more customisation options.",
                            headerColor: UIColor(red: 255.0, green: 255.0, blue: 255.0, alpha: 1.0), 
                            messageColor: UIColor(red: 239.0, green: 239.0, blue: 239.0, alpha: 0.7), 
                            primary_color: UIColor(red: 0.0, green: 0.0, blue: 0.0, alpha: 0.5), 
                            secondary_color: UIColor(red: 0.0, green: 0.0, blue: 0.0, alpha: 1.0), 
                            icon_image: UIImage(named: "apple")!, duration: .long, toastStyle: .style_pale, 
                            toastGravity: .bottom, toastCornerRadius: 12, pulseEffect: true)

查看此库的 Android 版本 Motion Toast

设计灵感来自 @Spikeysanju

捐赠

如果这个项目帮助您节省了开发时间,您可以为我要一杯咖啡哦:)

Buy Me A Coffee

作者

Sameer Nawaz,[email protected]

许可协议

MotionToastView基于MIT协议可用。有关更多信息,请参阅LICENSE文件。