Toast Alert View
一个用于在iOS中显示Toast Alerts的框架。
功能
- 带有消息和图像的Toast视图
- 带有时效关闭的Toast视图
- 可点击关闭的Toast视图
- 自定义Toast视图
安装
Swift包管理器
通过Swift包管理器将其添加到现有iOS项目中
- 使用Xcode 11,转到文件 > Swift包 > 添加包依赖
- 粘贴项目URL:https://github.com/estampworld/ios-toast-alerts
- 点击“下一步”并选择项目目标
Carthage
将以下行添加到您的Cartfile中
github "estampworld/ios-toast-alerts"
运行 carthage update
Cocoapods
将Pod添加到您的Podfile中
pod 'toastalerts'
然后运行
pod install
用法
Swift
Toast Alert View with Message & Image
使用ToastAlertView对象显示带有消息和图标的Toast Alert
let toastAlertView = ToastAlertView(message: "Hey!", image: UIImage(named: "Cat Icon")!)
toastAlertView.show()
Toast Alert View with Time Dissmis Only
//Toast Alert View with Time Dissmis Only
let toastAlertView = ToastAlertView(message: "4 Seconds", image: UIImage(systemName: "flame")!, hideWithType: .time(time: 4))
toastAlertView.show()
自定义Toast Alert View显示
//Custom EW Toast Alert View
let toastAlertView = ToastAlertView()
toastAlertView.message = "Example"
toastAlertView.image = UIImage(named: "img1")!
toastAlertView.show()
//toastAlertView.dismiss() to Hide
示例
维护者
Eduardo Irias,创建者。
贡献
- 将其分叉( https://github.com/[my-github-username]/ios-toast-alerts/fork )
- 创建你的功能分支(git checkout -b feature/[my-new-feature])
- 提交您的更改(git commit -am '添加一些功能')
- 推送到分支(git push origin feature/[my-new-feature])
- 创建一个新的拉取请求
许可
Toast Alert Views 可在 MIT 许可下使用。有关更多信息,请参阅 LICENSE 文件。