StepProgressView

带有标签和形状的步进式进度视图。是 UIActivityIndicatorView 和 UIProgressView 的良好替代品。

Swift Version Build Status License CocoaPods Compatible
Platform PRs Welcome

用法

let progressView   = StepProgressView(frame: view.bounds)
progressView.steps = ["First", "Second", "Third", "Last"]
progressView.details = [0: "The beginning", 3: "The end"] // appears below step title

progressView.currentStep = 0 // started first step
...
progressView.currentStep = 4 // all done

SwiftUI 用法

StepsView(currentStep: $step, steps: ["First", "Second", "Third", "Done"])
    .stepShape(.rhombus)

更改外观

以下属性可以在 Interface Builder 中、代码中或通过 UIAppearance 代理设置(例如,StepProgressView.appearance().stepShape = .circle)。使用 SwiftUI 时,您可以在 StepsView 初始化器中或使用 SwiftUI 视图修饰符设置它们。

步骤图标的形状

progressView.stepShape = .circle
progressView.firstStepShape = .rhombus
progressView.lastStepShape = .square
// also available: .triangle, .downTriangle

文本字体和大小

progressView.textFont = myFont
progressView.detailFont = anotherFont

线条大小间距

progressView.lineWidth = 2.5
progressView.verticalPadding = 8 // between steps (0 => default based on textFont)
progressView.horizontalPadding: 8 // between shape and text (0 => default based on textFont)

颜色

progressView.tintColor = myGeneralTintColor

// alternatively:

progressView.currentStepColor = .red
progressView.pastStepColor = .gray
progressView.futureStepColor = .gray

progressView.currentStepFillColor = .yellow
progressView.pastStepFillColor = .gray
progressView.futureStepFillColor = .lightGray

progressView.currentTextColor = .blue
progressView.pastTextColor = .gray
progressView.futureTextColor = .lightGray
progressView.currentDetailColor = .cyan // nil => use currentStepColor

安装

CocoaPods

pod 'StepProgressView'

旧版本

Swift 版本 StepProgressView 版本
4.0 (Xcode 9.4) pod 'MiniLayout', '~> 1.2.1'
pod 'StepProgressView', '~> 1.4.1'
3 pod 'MiniLayout', '~> 1.1.0'
pod 'StepProgressView', '~> 1.3.0'
2.3 pod 'MiniLayout', '~> 1.0.1'
pod 'StepProgressView', '~> 1.2.1'

Swift Package Manager

dependencies: [
    .package(url: "https://github.com/yonat/StepProgressView", from: "1.6.6")
]

Meta

@yonatsharon

https://github.com/yonat/StepProgressView