https://github.com/ponysoloud/ap-step-control-view
Nice way to interact with elements stack
https://github.com/ponysoloud/ap-step-control-view
cocoapod constraints control navigation-controller stackview swift-framework view
Last synced: 7 months ago
JSON representation
Nice way to interact with elements stack
- Host: GitHub
- URL: https://github.com/ponysoloud/ap-step-control-view
- Owner: ponysoloud
- License: mit
- Created: 2018-04-24T22:38:23.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2020-02-02T10:29:27.000Z (over 6 years ago)
- Last Synced: 2025-08-12T12:46:16.882Z (10 months ago)
- Topics: cocoapod, constraints, control, navigation-controller, stackview, swift-framework, view
- Language: Swift
- Homepage:
- Size: 6.51 MB
- Stars: 3
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# APStepControlView
[](https://cocoapods.org/pods/APStepControlView)
[](https://cocoapods.org/pods/APStepControlView)
[](https://cocoapods.org/pods/APStepControlView)
[](https://cocoapods.org/pods/APStepControlView)
`APStepControlView` is beautiful control element that provides to user easy and lovely way to decrease count of elements in list. It may be useful to manipulate with `Navigation controller` hierarchy.

## Requirements
- iOS 10.0+
- Xcode 9
## Installation
You can use [CocoaPods](http://cocoapods.org/) to install `APStepControlView` by adding it to your `Podfile`:
```ruby
platform :ios, '10.0'
use_frameworks!
target 'MyApp' do
pod 'APStepControlView'
end
```
## Usage
#### Initialization
```swift
import APStepControlView
```
`APStepControlView` have one initializer to set initial count of steps.
```swift
let stepControlView = APStepControlView(stepsCount: 5)
```
Also, `APStepControlView` is a `UIView` and can be initialized like it.
```swift
let rect = CGRect(x: 40, y: 200, width: 200, height: 40)
let stepControlView = APStepControlView(frame: rect)
```
#### APStepControlViewDelegate
You can implement `APStepControlViewDelegate` to be notified about actions with `APStepControlView` and control behaviour
```swift
class StepControlViewDelegateImpl: APStepControlViewDelegate {
func stepControlView(_ stepControlView: APStepControlView, didChangeStepsCountFrom count: Int, to newCount: Int) {
print("Number of steps changed from \(count) to \(newCount)")
}
func stepControlView(_ stepControlView: APStepControlView, shouldPopStepWithIndex index: Int) -> Bool {
return index > 0 // In an array, at least one element
}
}
```
```swift
let stepControlViewDelegateImpl = StepControlViewDelegateImpl()
stepControlView.delegate = stepControlViewDelegateImpl
```
#### Customizing
Steps indicators colors are customizable. It can be set with `ColorStyles` objects for every Indicator type.

```swift
stepControl.commonIndicatorColorStyle.circle = .black
stepControl.peekIndicatorColorStyle.circle = .red
stepControl.peekIndicatorColorStyle.border = .blue
```
####
If you don't need to take user touch control and want to manipulate it with forced `pow()` and `pop()`, just set `isUserInteractionEnabled = false`.
#### AutoLayout
You can position and resize view through `frame`, `center` and other properties or use constraints. If you use constraints, you shouldn't strongly fix width. It allows to autoresize view on pushing and poping steps, increase size of view correctly on tap.