{"id":13769593,"url":"https://github.com/kyleweiner/KWStepper","last_synced_at":"2025-05-11T02:32:51.123Z","repository":{"id":22155279,"uuid":"25486638","full_name":"kyleweiner/KWStepper","owner":"kyleweiner","description":"A stepper control with flexible UI and tailored UX.","archived":false,"fork":false,"pushed_at":"2019-11-04T06:07:25.000Z","size":358,"stargazers_count":172,"open_issues_count":0,"forks_count":31,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-04-25T12:06:48.129Z","etag":null,"topics":["stepper","swift","uistepper"],"latest_commit_sha":null,"homepage":null,"language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kyleweiner.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-10-20T21:05:02.000Z","updated_at":"2025-03-04T02:38:00.000Z","dependencies_parsed_at":"2022-08-19T18:10:34.749Z","dependency_job_id":null,"html_url":"https://github.com/kyleweiner/KWStepper","commit_stats":null,"previous_names":[],"tags_count":21,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kyleweiner%2FKWStepper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kyleweiner%2FKWStepper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kyleweiner%2FKWStepper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kyleweiner%2FKWStepper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kyleweiner","download_url":"https://codeload.github.com/kyleweiner/KWStepper/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253507159,"owners_count":21919159,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["stepper","swift","uistepper"],"created_at":"2024-08-03T17:00:29.074Z","updated_at":"2025-05-11T02:32:50.693Z","avatar_url":"https://github.com/kyleweiner.png","language":"Swift","funding_links":[],"categories":["Progress"],"sub_categories":[],"readme":"# KWStepper\n\n[![Version](https://img.shields.io/cocoapods/v/KWStepper.svg?style=flat)](http://cocoapods.org/?q=kwstepper)\n[![Carthage](https://img.shields.io/badge/carthage-compatible-brightgreen.svg?style=flat)](https://github.com/Carthage/Carthage)\n[![Documentation](https://img.shields.io/badge/docs-100%25-FF8200?style=flat)](http://cocoadocs.org/docsets/KWStepper)\n[![Platform](https://img.shields.io/cocoapods/p/KWStepper.svg?style=flat)](http://cocoapods.org/?q=kwstepper)\n[![License](https://img.shields.io/cocoapods/l/KWStepper.svg?style=flat)](https://raw.githubusercontent.com/kyleweiner/KWStepper/master/LICENSE)\n\nKWStepper is a stepper control written in Swift. Unlike [UIStepper](https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIStepper_Class/index.html), KWStepper allows for a fully customized UI and provides callbacks for tailoring the UX.\n\n\u003cp align=\"center\"\u003e\n\u003cimg src=\"screenshots.png\" alt=\"KWStepper Screenshot\"\u003e\n\u003c/p\u003e\n\nKWStepper was initially created in Objective-C for [Addo Label's](http://addolabel.com/) [Counters•](http://addolabel.com/counters) and is now available in Swift for you to enjoy :grin:\n\n## Features\n\n* Allows for a fully customized UI.\n* Provides properties for setting different decrement and increment steps.\n* Offers optional callbacks for responding to control events and tailoring the UX.\n* Supports method chaining for easier configuration and event handling.\n\n## Installation\n\n### CocoaPods\n\nKWStepper is available through [CocoaPods](http://cocoapods.org). To install\nit, simply add the following lines to your `Podfile`:\n\n```ruby\nuse_frameworks!\npod 'KWStepper'\n```\n\n### Carthage\n\nTo integrate KWStepper using [Carthage](https://github.com/Carthage/Carthage), add the following line to you `Cartfile`:\n\n```ogdl\ngithub \"kyleweiner/KWStepper\"\n```\n\n### Swift Package Manager\n\nTo add KWStepper to your Xcode project via [Swift Package Manager](https://swift.org/package-manager/), select `File → Swift Packages → Add Package Dependency…` and enter the URL for this repository.\n\n### Manually\n\nIf you prefer not to use a dependency manager, simply copy the [source files](https://github.com/kyleweiner/KWStepper/tree/master/Source) into your project.\n\n## Usage\n\nTry the example project!\n\n```swift\nvar stepper: KWStepper!\n\n@IBOutlet weak var countLabel: UILabel!\n@IBOutlet weak var decrementButton: UIButton!\n@IBOutlet weak var incrementButton: UIButton!\n```\n\n```swift\nstepper = KWStepper(decrementButton: decrementButton, incrementButton: incrementButton)\n```\n\nRespond to control events using the `valueChangedCallback` property.\n\n```swift\nstepper.valueChangedCallback = { stepper in\n    self.countLabel.text = String(stepper.value)\n}\n```\n\nOr, use the target-action pattern.\n\n```swift\nstepper.addTarget(self, action: #selector(stepperDidChange), for: .valueChanged)\n```\n\n### Configuring KWStepper\n\nWith the exception of the `continuous` property, KWStepper offers everything provided by [UIStepper](https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIStepper_Class/index.html) and more.\n\n```swift\nstepper.autoRepeat = true\nstepper.autoRepeatInterval = 0.10\nstepper.wraps = true\nstepper.minimumValue = 0\nstepper.maximumValue = 8\nstepper.value = 0\nstepper.incrementStepValue = 1\nstepper.decrementStepValue = 1\n```\n\nMethod chaining is also supported:\n\n```swift\nstepper\n    .wraps(true)\n    .maximumValue(10)\n    .stepValue(2)\n    .valueChanged { stepper in\n        // ...\n    }\n```\n\nIf necessary, the rounding behavior for incrementing and decrementing may be modified via `roundingBehavior`.\n\n### KWStepperDelegate\n\nAdopting `KWStepperDelegate` provides the following optional delegate methods for tailoring the UX.\n\n* `optional func KWStepperDidDecrement()`\n* `optional func KWStepperDidIncrement()`\n* `optional func KWStepperMaxValueClamped()`\n* `optional func KWStepperMinValueClamped()`\n* `optional func KWStepperDidEndLongPress()`\n\n### Callbacks\n\nKWStepper provides the following callbacks:\n\n* `valueChangedCallback`\n* `decrementCallback`\n* `incrementCallback`\n* `maxValueClampedCallback`\n* `minValueClampedCallback`\n* `longPressEndedCallback`\n\nMethod chaining is supported for callbacks too:\n\n```swift\nstepper\n    .valueChanged { _ in }\n    .didDecrement { _ in }\n    .didIncrement { _ in }\n    .maxValueClamped { _ in }\n    .minValueClamped { _ in }\n    .longPressEnded { _ in }\n\n// `maxValueClampedCallback` and `minValueClampedCallback` may be set simultaneously.\nstepper.valueClamped { stepper in\n    // ...\n}\n```\n\nIn the example project, `valueChanged(_:)` is used to update the count label text when the stepper value changes. `valueClamped(:_)` is used to present a `UIAlertController` when a limit is reached and the `wraps` property is set to `false`.\n\n## Author\n\nKWStepper was written by Kyle Weiner and [contributors](https://github.com/kyleweiner/KWStepper/contributors).\n\n## License\n\nKWStepper is available under the MIT license. See the LICENSE file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkyleweiner%2FKWStepper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkyleweiner%2FKWStepper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkyleweiner%2FKWStepper/lists"}