{"id":15038373,"url":"https://github.com/mattlewin/numericpicker","last_synced_at":"2025-04-10T01:23:08.661Z","repository":{"id":62449185,"uuid":"81506183","full_name":"MattLewin/NumericPicker","owner":"MattLewin","description":"iOS picker for easily selecting numbers by digit. (Swift)","archived":false,"fork":false,"pushed_at":"2018-10-10T02:33:29.000Z","size":232,"stargazers_count":18,"open_issues_count":3,"forks_count":6,"subscribers_count":1,"default_branch":"develop","last_synced_at":"2025-04-08T23:17:49.064Z","etag":null,"topics":["accessibility","carthage","cocoapods","dynamic-font","ios","numeric","picker","pickerview","swift","swift-4","swift4"],"latest_commit_sha":null,"homepage":"","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/MattLewin.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-02-09T23:42:23.000Z","updated_at":"2023-11-01T20:54:12.000Z","dependencies_parsed_at":"2022-11-01T23:17:44.657Z","dependency_job_id":null,"html_url":"https://github.com/MattLewin/NumericPicker","commit_stats":null,"previous_names":[],"tags_count":22,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MattLewin%2FNumericPicker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MattLewin%2FNumericPicker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MattLewin%2FNumericPicker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MattLewin%2FNumericPicker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MattLewin","download_url":"https://codeload.github.com/MattLewin/NumericPicker/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248138528,"owners_count":21053866,"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":["accessibility","carthage","cocoapods","dynamic-font","ios","numeric","picker","pickerview","swift","swift-4","swift4"],"created_at":"2024-09-24T20:38:13.067Z","updated_at":"2025-04-10T01:23:08.641Z","avatar_url":"https://github.com/MattLewin.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# NumericPicker\n\n[![Version](https://img.shields.io/cocoapods/v/NumericPicker.svg?style=flat)](http://cocoapods.org/pods/NumericPicker)\n[![License](https://img.shields.io/cocoapods/l/NumericPicker.svg?style=flat)](http://cocoapods.org/pods/NumericPicker)\n[![Platform](https://img.shields.io/cocoapods/p/NumericPicker.svg?style=flat)](http://cocoapods.org/pods/NumericPicker)\n[![Swift Version](https://img.shields.io/badge/swift-4.2-blue.svg?style=flat)](https://swift.org)\n[![CI Status](http://img.shields.io/travis/MattLewin/NumericPicker.svg?style=flat)](https://travis-ci.org/MattLewin/NumericPicker)\n\n[![CocoaPods](https://img.shields.io/badge/CocoaPods-compatible-4BC51D.svg?style=flat)](https://cocoapods.org/pods/NumericPicker)\n[![Carthage](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)\n[![Swift Package Manager](https://img.shields.io/badge/SPM-not%20yet-red.svg?style=flat)](https://swift.org/package-manager/)\n\n[![GitHub release](https://img.shields.io/github/release/MattLewin/NumericPicker.svg)](https://github.com/MattLewin/NumericPicker/releases)\n\n## Description\n\nNumericPicker is a drop-in iOS picker control written in Swift. It simplifies the creation of pickers that allow\nyour users to specify numbers by digit. It automatically uses the proper grouping and decimal separator for the\ncurrent (or specified) locale. You can easily dictate the number of integer and decimal places in the controller.\n\n![Sample Video](https://cl.ly/j5XO/Screen%20Recording%202017-02-08%20at%2003.36%20PM.gif)\n\n*Note that the \"Picker Value\" field is there for demonstration purposes only. It is not included in the\n`NumericPicker` control.*\n\n---\n\n## Table of Contents\n\n* [Example](#example)\n* [Minimum Requirements](#minimum-requirements)\n* [Installation](#installation)\n* [Usage](#usage)\n* [Author](#author)\n* [License](#license)\n\n---\n\n## Minimum Requirements\n### Version 1.1.x\n* Xcode 10\n* iOS 10.3\n* Swift 4.2\n\n### Version 1.0.x\n* Xcode 9\n* iOS 10.3\n\n## Example\n\nThis repo contains an example project demonstrating how to use the `NumericPicker` control from Interface Builder and\nfrom code.\n\nTo run the example project, clone the repo, open `NumericPicker.xcodeproj` and run the `NumericPicker-Example` scheme\n\n## Installation\n\n### CocoaPods\n\nNumericPicker is available through [CocoaPods](http://cocoapods.org). \n\n[CocoaPods](http://cocoapods.org) is a dependency manager for Swift and Objective-C that simplifies the use of 3rd-party\nlibraries like `NumericPicker` in your projects.\n\nFirst, add the following line to your [Podfile](http://guides.cocoapods.org/using/using-cocoapods.html):\n\n```ruby\npod \"NumericPicker\"\n```\n\nor, for Xcode 9 and Swift 4.0\n\n```ruby\npod \"NumericPicker\", '~\u003e 1.0.0'\n```\n\nSecond, install `NumericPicker` into your project:\n\n```bash\npod install\n```\n\n### Carthage \n\n[Carthage](https://github.com/Carthage/Carthage) is a decentralized dependency manager that builds your dependencies and\nprovides you with binary frameworks. \n\nTo integrate `NumericPicker` into your Xcode project using Carthage, specify it in your `Cartfile`:\n\n```ruby\ngithub \"MattLewin/NumericPicker\"\n```\n\nor, for Xcode 9 and Swift 4.0\n\n```ruby\ngithub \"MattLewin/NumericPicker\" ~\u003e 1.0.0\n```\n\nRun `carthage update` to build the framework and drag the built `NumericPicker.framework` (in Carthage/Build/iOS folder)\ninto your Xcode project (Linked Frameworks and Libraries in `Targets`).\n\n### Swift Package Manager (SPM)\n\nThe [Swift Package Manager](https://github.com/apple/swift-package-manager) does not yet support importing `UIKit` or compilation for\n`iOS`. Thus, `NumericPicker` can not yet be used with the SPM.\n\n### Manually\n\n1. Copy `NumericPicker.swift` into your project\n2. Have a nice day\n\n## Usage\n\n`NumericPicker` is a subclass of [`UIControl`](https://developer.apple.com/reference/uikit/uicontrol). In this way it\nis more like [`UIDatePicker`](https://developer.apple.com/reference/uikit/uidatepicker) than it is like \n[`UIPickerView`](https://developer.apple.com/reference/uikit/uipickerview). What this means for you is that you don't \nneed to implement [`UIPickerViewDataSource`](https://developer.apple.com/reference/uikit/uipickerviewdatasource) or\n[`UIPickerViewDelegate`](https://developer.apple.com/reference/uikit/uipickerviewdelegate).\n\n*Note that the provided [Example](#example) demonstrates everything detailed below.*\n\n### Configurable Properties\n\n* `value: Double` - The value displayed in the picker. Set this value to update the picker programatically. \n*(Default: 0)*\n* `minIntegerDigits: Int` - The minimum number of integer digits (digits to the left of the decimal separator) to\ninclude in the picker. Think of this as zero-padding the picker. If `value` requires more than this minimum, the picker\nwill automatically meet this requirement. (This is probably not what you want, though.) *(Default: 1)*   \n* `fractionDigits: Int` - The number of digits to the right of the decimal separator. `NumericPicker` guarantees\nexactly this many fractional digits will be displayed. You can use this to achieve rounding or zero-padding of values\nto the right of the decimal separator. *(Default: 0)*\n* `locale: Locale` - The locale used to format the numeric values. Use this if you want numbers formatted with\nseparators other than those used by the device locale. *(Default: current device locale)*\n* `font: UIFont` - The font used to format the picker components. *(Default: `Body` text style)*\n* `displayString: String` - **READ ONLY** - The text representation of `value`. This string will contain locale-specific\ngrouping and decimal separators. It will have exactly `fractionDigits` digits to the right of the decimal separator and \nthe minimum number of integer places necessary to represent `value`.\n\n\n### Interface Builder\n\nTo use `NumericPicker` with Interface Builder, add a [`UIControl`](https://developer.apple.com/reference/uikit/uicontrol)\nto your storyboard or XIB, and then set the \"Custom Class\" to `NumericPicker`. Connect the \"`Value Changed`\" event to\na function in your view controller. (Be certain to set the \"Type\" to `NumericPicker` as shown below.)\n\n![IBAction](https://cl.ly/1s1Q1E3J3w1c/IBAction.png)\n\nWithin that function, you can access `sender.displayString` or `sender.value` as needed.   \n\n\n#### *Cocoapods or Manually*\n\nIf you are using Cocoapods or have dropped `NumericPicker.swift` into your code, you can configure `value`,\n`minIntegerDigits`, and `fractionDigits` from the \"Attributes\" inspector.\n\n![IB NumericPicker](https://cl.ly/j5h1/NumericPicker-IB.png)\n\n#### *Carthage*\n\nXcode does not currently (as of 9.0) support `@IBInspectable` properties from external frameworks. The means\nyou cannot configure the above properties in IB. You can, however, trick IB into rendering `NumericPicker` with its\ndefault values by adding the following code to one of your view controllers:\n\n```swift\n@IBDesignable extension NumericPicker { }\n```\n\n### Code\n\nAdd a `NumericPicker` control from code as you would any other subview. Here is the code from \n`NumericPicker-Example/ViewController.swift` to produce the bottom sample `NumericPicker`. Note that it is typically unnecessary\nto set `locale`, as `NumericPicker` will use the current device locale by default.\n\n```swift\nvar codeNumericPicker = NumericPicker()\ncodeNumericPicker.minIntegerDigits = 6\ncodeNumericPicker.fractionDigits = 3\ncodeNumericPicker.value = 76543.21\ncodeNumericPicker.locale = Locale(identifier: \"de-DE\")\ncodeNumericPicker.addTarget(self, action: #selector(codeValueChanged), for: .valueChanged)\ncodePickerStack.addArrangedSubview(codeNumericPicker)\n\n```\n\n## Author\n\nMatt Lewin, matt@mogroups.com\n\n## License\n\nNumericPicker is available under the MIT license. See [LICENSE.md](https://raw.githubusercontent.com/MattLewin/NumericPicker/master/LICENSE.md) \nfor more info.\n\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmattlewin%2Fnumericpicker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmattlewin%2Fnumericpicker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmattlewin%2Fnumericpicker/lists"}