JonAlert
一个简单优雅的警报,类似 Spotify 的样式,使用 Swift 编写。JonAlert 可以在用户执行某些操作后提供反馈。
易于使用
如何使用
// First import the library to the ViewController you want to use it.
import JonAlert
// Then, you just have to call the alert anywhere you desire:
JonAlert.show(message: "Simple message...")
成功和错误警报
// If you want to show feedback for a success or error situation,
// you can simply call:
JonAlert.showSuccess(message: "Success!!")
JonAlert.showError(message: "Something went wrong...")
显示自定义图标
// Last but not least, you can use a custom image to be displayed:
let myImage = UIImage(named: "myImage")
JonAlert.show(message: "Simple message...", andIcon: myImage)
更改警报显示速度
// The alert default displaying speed is 1 second. So, when you
// call any of the "show" methods the time between the alert
// appearing and disappearing will be of 1 second.
// To change de default time (in seconds) of the alert, use:
JonAlert.show(message: "", duration: 5.0)
安装
JonAlert 目前还不能通过 Cocoapods 来安装,但很快就会提供。
手动安装
首先下载 "JonAlert" 文件夹。然后在 Xcode 中,右键点击项目导航器中的项目节点根目录。点击“添加文件”到“YOURPROJECTNAME”。在文件选择器中,导航到 "Jon Alert" 文件夹所在的位置,并选择 JonAlert.xcodeproj。点击“添加”将 JonAlert.xcodeproj 添加为子项目。
选中项目节点顶层以打开项目编辑器。点击 YOUR_PROJECT_NAME 目标,然后转到通用选项卡。
向下滚动到嵌入式二进制文件部分。将 JonAlert.framework 从 JonAlert.xcodeproj 的产品文件夹中拖到这个部分。
现在你应该可以了!
协作
这是一个简单的库,是我为帮助自己的工作而创建的,因为我没有找到其他任何可以满足我需求的库。我知道这里还有很多改进和添加新功能的空间,所以,请随时提出想法或问题,欢迎协作!
作者
马丁斯·约翰athan,[email protected]
许可协议
JonAlert 以下 MIT 许可协议提供。有关更多信息,请参阅 LICENSE 文件。