{"id":13496814,"url":"https://github.com/openalloc/SwiftNumberPad","last_synced_at":"2025-03-28T19:31:11.787Z","repository":{"id":142712549,"uuid":"614032952","full_name":"openalloc/SwiftNumberPad","owner":"openalloc","description":"A multi-platform SwiftUI component for basic number input","archived":false,"fork":false,"pushed_at":"2023-05-01T23:59:28.000Z","size":165,"stargazers_count":8,"open_issues_count":5,"forks_count":2,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-03-12T14:16:24.589Z","etag":null,"topics":["apple-watch","decimal","dialer","digits","ios","ipados","keyboard","keypad","macos","number-pad","numpad","swift","swift-lang","swift-library","swift-package","swiftui","swiftui-components","watchos"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/openalloc.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-03-14T18:53:31.000Z","updated_at":"2024-11-04T09:50:11.000Z","dependencies_parsed_at":"2023-11-18T00:23:27.361Z","dependency_job_id":null,"html_url":"https://github.com/openalloc/SwiftNumberPad","commit_stats":{"total_commits":16,"total_committers":1,"mean_commits":16.0,"dds":0.0,"last_synced_commit":"4bc141a30dfb60e49452b731260127d577f60bf4"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openalloc%2FSwiftNumberPad","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openalloc%2FSwiftNumberPad/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openalloc%2FSwiftNumberPad/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openalloc%2FSwiftNumberPad/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/openalloc","download_url":"https://codeload.github.com/openalloc/SwiftNumberPad/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246088451,"owners_count":20721688,"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":["apple-watch","decimal","dialer","digits","ios","ipados","keyboard","keypad","macos","number-pad","numpad","swift","swift-lang","swift-library","swift-package","swiftui","swiftui-components","watchos"],"created_at":"2024-07-31T19:02:00.575Z","updated_at":"2025-03-28T19:31:11.496Z","avatar_url":"https://github.com/openalloc.png","language":"Swift","funding_links":[],"categories":["Swift"],"sub_categories":[],"readme":"# SwiftNumberPad\n\nA multi-platform SwiftUI component for basic number input.\n\nAvailable as an open source library to be incorporated in SwiftUI apps.\n\n_SwiftNumberPad_ is part of the [OpenAlloc](https://github.com/openalloc) family of open source Swift software tools.\n\n\u003cimg src=\"https://github.com/openalloc/SwiftNumberPad/blob/main/Images/float_demo.png\" width=\"178\" height=\"350\"\u003e\n\n## Features\n\n* Support for integer, floating point, and Decimal types\n* Presently targeting .macOS(.v13), .iOS(.v16), .watchOS(.v9)\n* No external dependencies!\n\n## Example\n\nA basic example of Float-based input with a specified precision.\n\n```swift\nstruct NumberPadExample: View {\n    @Binding var calories: Float\n\n    init(myValue: Binding\u003cFloat\u003e) {\n        _calories = myValue\n        config = .init(myValue.wrappedValue, precision: 1, upperBound: 1000)\n    }\n\n    @ObservedObject var config: NPFloatConfig\u003cFloat\u003e\n\n    var body: some View {\n        VStack {\n            Text(\"\\(config.stringValue)\")\n\n            NumberPad(config: config)\n                .buttonStyle(.bordered)\n        }\n        .font(.largeTitle)\n        .navigationTitle(\"Calories\")\n        .toolbar {\n            ToolbarItem {\n                Button(\"Save\") {\n                    calories = config.value ?? 0\n                }\n            }\n        }\n        .padding()\n    }\n}\n\nstruct NumPadExample_Previews: PreviewProvider {\n    static var previews: some View {\n        NavigationStack {\n            NumberPadExample(myValue: .constant(Float(233.6)))\n        }\n    }\n}\n```\n\n\n## TODO\n\nPlease submit pull requests if you'd like to tackle any of these. Thanks!\n\n* Usage documentation in this README\n* SwiftUI Preview not reliably working on macOS\n* See if earlier versions of platforms can be supported\n* Support for negative values\n\n## See Also\n\nThis library is a member of the _OpenAlloc Project_.\n\n* [_OpenAlloc_](https://openalloc.github.io) - product website for all the _OpenAlloc_ apps and libraries\n* [_OpenAlloc Project_](https://github.com/openalloc) - Github site for the development project, including full source code\n\n## License\n\nCopyright 2023 OpenAlloc LLC\n\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use this file except in compliance with the License. You may obtain a copy of the License at\n\n[http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0)\n\nUnless required by applicable law or agreed to in writing, software distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.\n\n## Contributing\n\nContributions are welcome. You are encouraged to submit pull requests to fix bugs, improve documentation, or offer new features. \n\nThe pull request need not be a production-ready feature or fix. It can be a draft of proposed changes, or simply a test to show that expected behavior is buggy. Discussion on the pull request can proceed from there.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopenalloc%2FSwiftNumberPad","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fopenalloc%2FSwiftNumberPad","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopenalloc%2FSwiftNumberPad/lists"}