概览
Degree
是一个用于在Swift中创建渐变的工具。
如何开始
- 将
Source
文件夹的内容复制到您的项目中。
或者
- 使用
Degree
Cocoapod
需求
- iOS 9以及以后的版本
- Xcode 9以及以后的版本
- Swift 4
使用方法
使用示例
let gradientView = GradientView()
gradientView.gradient = Gradient.make
.from(
x: .left,
y: .top
)
.to(
x: .right,
y: .bottom
)
.step(withColor: .white, andLocation: 0.0)
.step(withColor: .orange, andLocation: 0.5)
.step(withColor: .purple, andLocation: 1.0)
.get
每个步骤都由其颜色和位置定义,位置是一个从0.0
到1.0
的Float
值。
许可证
度(Degree)
可在 MIT 许可证下使用。有关更多信息,请参阅 LICENSE 文件。