SwiftUI iOS component for Step Indications.
To run the example project, clone the repo, and run pod install
from the Example directory first.
- iOS 13.0+
- Xcode 11.2+
- Swift 5.0+
- CocoaPods 1.6.1+
StepperView is available through CocoaPods. To install it, simply add the following line to your Podfile.
pod 'StepperView'
StepperView is available through Swift Package Manager. To install it, simply add the foollowing dependency to your Package.swift
.package(url: "https://github.com/badrinathvm/StepperView.git", from: "1.0.6")
import StepperView
let alignments = [StepperAlignment.top,.center,.bottom]
let indicatorTypes = [ StepperIndicationType<AnyView>.circle(Colors.teal.rawValue, 12),
StepperIndicationType.image(Image(systemName: "arrow.right.circle", 12)),
StepperIndicationType.image(Image(systemName: "arrow.uturn.right", 12))
]
var body: some View {
var body: some View {
StepperView(cells: [cellBody, cellBody , cellBody],
alignments: alignments,
indicationType:indicatorTypes,
lineOptions: StepperLineOptions.custom(1,Colors.gray.rawValue))
}
}
var cellBody:some View {
VStack(alignment: .leading) {
ForEach(["Top","Center","Bottom"], id:\.self) { value in
HStack {
Text(value)
.foregroundColor(Color.gray)
.padding(.vertical , 10)
.padding(.horizontal, 5)
Spacer()
}
}
}
}
- cells : array of views to be rendered next to step Indicator
- alignments: defaults to .center, for custom options pass list of view alignments to be pointed for eg: can be .top , .center , .bottom sections
- indicatorTypes: enum provides the options to use .circle(color, width) , .image(Image, width) or .custom(AnyView)
- lineOptions: optional parameter to customize the line for thickness and color options.
- verticalSpacing: optional parameter for vertical spacing
Refer Example for more details on usage of StepperView
Badarinath Venkatnarayansetty
Follow and contact me on Twitter or LinkedIn. If you find an issue, just open a ticket. Pull requests are welcome.
StepperView is available under the MIT license. See the LICENSE file for more info.