SKToast
示例
要运行示例项目,请克隆仓库,然后首先从示例目录运行 pod install
。
特性
- ToastView 定制
- 简单快速集成
系统要求
- iOS 13.0+
- Xcode 11+
- Swift 5.0+
安装
CocoaPods
要使用CocoaPods将SKToast集成到你的Xcode项目中,请在你的Podfile
中指定它。
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '13.0'
use_frameworks!
target '<Your Target Name>' do
pod 'SKToast', '~> 1.0.0'
end
然后,运行以下命令
$ pod install
手动
您可以将SKToastView.swift
源文件直接添加到您的Xcode项目中。
使用import SKToast
在任何需要使用SKToast的地方引入它。
使用
(在/Example
中查看示例Xcode项目) 要运行示例项目,请克隆仓库,并首先从Example目录中运行pod install
。
导入模块。
import SKToast
现在,您可以显示带有状态信息的ToastView
SKToast.show(withMessage: "Please check your intenet connection.")
使用状态信息和completionHandler显示ToastView
SKToast.show(withMessage: "Your internet connection appears to be offline, please check your internet connection") {
print("Perform any task after toast disappearance.")
}
自定义
// default is dark
SKToast.backgroundStyle(.light)
// default is white
SKToast.messageTextColor(UIColor.black)
// default is System Font
let myFont = UIFont(name: "AvenirNext-DemiBold", size: 16)
SKToast.messageFont(myFont!)
// ToastView background styles
SKToast.backgroundStyle(.light)
SKToast.backgroundStyle(.extraLight)
SKToast.backgroundStyle(.dark)
许可证
SKToast在MIT许可证下可用。有关详细信息,请参阅LICENSE。