测试已测试 | ✗ |
Lang语言 | SwiftSwift |
许可 | MIT |
Released最后发布 | 2017年2月 |
SwiftSwift版本 | 3.0 |
SPM支持SPM | ✗ |
由 Kesava Jawaharlal 维护。
这是一个开源库,它显示了六边形形状的加载指示器,由 CAShapeLayer 和 CABasicAnimation 开发。该库高度可定制。
在 Appetize.io 上尝试 HexLoader
。
要运行示例项目,请克隆仓库,并首先从 Example 目录中运行 pod install
。
黑暗背景带加载文本 | 浅色背景不带加载文本和没有内部偏移 |
---|---|
![]() | ![]() |
透明背景 | 深色背景不含背景 |
![]() | ![]() |
透明背景带有自定义的加载文本颜色 | |
![]() |
HexLoader 可通过 CocoaPods 获取。安装它,只需将以下行添加到 Podfile 中即可
pod "HexLoader"
只需将“HexLoader/Classes”文件夹下的文件复制粘贴即可开始。
该库有一个名为 'LoadingViewPresentable' 的协议扩展,它使任何视图控制器都能轻松调用该库而无需任何样板代码。要启动加载器,您只需要从任何 UIViewControllers 中调用以下两个公共函数之一。
startLoading()
或者调用以下函数,以便在指示器下方显示一些文本。
startLoading(with: "Loading...")
通过调用以下函数可以停止指示器
stopLoading()
通过 Singleton 类 'HexLoaderConfig' 暴露出大量的自定义选项。以下是一些可用的参数
/**
* Length of each side
*/
HexagonLoaderConfig.shared.hexagonSideLength = 60
/**
* Inner offset for each Hexagon
*/
HexagonLoaderConfig.shared.hexagonInnerOffset = 2
/**
* Color of Hexagon
*/
HexagonLoaderConfig.shared.hexagonBackgroundColor = .white
/**
* Color of Hexagon border
*/
HexagonLoaderConfig.shared.hexagonBorderColor = white
/**
* Background Type
*/
HexagonLoaderConfig.shared.backgroundType = .transparent
/**
* Boolean to indicate if a backdrop over lay is needed to be displayed
*/
HexagonLoaderConfig.shared.displayBackdropOverlay = true
/**
* Backdrop Overlay Color. This will be used only if'displayBackdropOverlay' var is set to true
*/
HexagonLoaderConfig.shared.backdropOverlayColor = #colorLiteral(red: 0.4156862745, green: 0.7176470588, blue: 0.968627451, alpha: 1)
/**
* Backdrop Overlay Corner Radius. This will be used only if'displayBackdropOverlay' var is set to true
*/
HexagonLoaderConfig.shared.backdropOverlayCornerRadius = 10
/**
* Loading Text Font
*/
HexagonLoaderConfig.shared.loadingTextFont = UIFont.systemFont(ofSize: 17)
/**
* Loading Text Color
*/
HexagonLoaderConfig.shared.loadingTextColor = .white
/**
* Animation Speed of the loader
*/
HexagonLoaderConfig.shared.animationSpeed = 1
Kesava Jawaharlal, [email protected]
HexLoader 在 MIT 许可协议下提供。有关更多信息,请参阅 LICENSE 文件。