Shiny
Shiny是一个iOS库,它生成与陀螺仪匹配的彩虹色效果视图,类似于钱包应用中Apple Pay Cash卡。
$ pod try Shiny
要求
- iOS 9.0+
- Xcode 9.0+
- Swift 5 (Shiny 2.x), Swift 4 (Shiny 1.x)
用法
以编程方式添加 ShinyView
(也支持 storyboard/xib)
import Shiny
let shinyView = ShinyView(frame: CGRect(x: 0, y: 0, width: 320, height: 200))
shinyView.colors = [.gray, .red, .green, .blue, .gray]
shinyView.startUpdates() // necessary
view.addSubview(shinyView)
必须调用实例的startUpdates()
以观察运动变化。在实例上调用stopUpdates()
将停止运动更新。
func startUpdates() // Starts listening to motion updates.
func stopUpdates() // Stops listening to motion updates.
自定义
ShinyView
公开了一些属性以自定义用于创建闪亮效果的径向渐变
var colors: [UIColor] // The color of each gradient stop.
var locations: [CGFloat]? // The location of each gradient stop. The default is `nil`.
var scale: CGFloat // The scale factor of the gradient. The default is `2.0`.
安装
Shiny 可通过 CocoaPods 和 Carthage 获得。
CocoaPods
使用 CocoaPods 安装,只需在 Podfile
中添加以下内容:
use_frameworks!
pod "Shiny"
Carthage
使用 Carthage 安装,只需在 Cartfile
中添加以下内容:
github "efremidze/Shiny"
Mentions
通信
- 如果你 发现了一个错误,请打开一个问题。
- 如果你 有功能请求,请打开一个问题。
- 如果你 想做出贡献,提交一个拉取请求。
使用 Shiny 的应用程序
如果你在使用这个库中的应用程序,请随意提交一个 PR。
许可证
Shiny 在 MIT 许可证下提供。有关更多信息,请参阅 LICENSE 文件。