mariozig / StepperView

SwiftUI iOS component for Step Indications.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

StepperView

CI Status Version License Platform

StepperView

StepperViewWithMultipleOptions

SwiftUI iOS component for Step Indications.

Usecase

example1

example2

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Requirements

  • iOS 13.0+
  • Xcode 11.2+
  • Swift 5.0+
  • CocoaPods 1.6.1+

Installation

StepperView is available through CocoaPods. To install it, simply add the following line to your Podfile.

pod 'StepperView'

Swift Package Manager

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")

Usage

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()
            }
        }
    }
}

Parameters

  • 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

Author

Badarinath Venkatnarayansetty

Contact

Follow and contact me on Twitter or LinkedIn. If you find an issue, just open a ticket. Pull requests are welcome.

License

StepperView is available under the MIT license. See the LICENSE file for more info.

About

SwiftUI iOS component for Step Indications.

License:MIT License


Languages

Language:Swift 97.4%Language:Ruby 2.6%