{"id":13778727,"url":"https://github.com/GGJJack/SwiftUIWheelPicker","last_synced_at":"2025-05-11T12:31:32.079Z","repository":{"id":62456844,"uuid":"409406235","full_name":"GGJJack/SwiftUIWheelPicker","owner":"GGJJack","description":"Custom horizontal wheel picker for SwiftUI","archived":false,"fork":false,"pushed_at":"2022-02-11T02:01:20.000Z","size":1439,"stargazers_count":95,"open_issues_count":2,"forks_count":12,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-11-16T19:37:02.250Z","etag":null,"topics":["cocoapods","ios","picker","swift","swiftui","swiftuihorizontalwheelpicker","swiftuiwheelpicker","wheel"],"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/GGJJack.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":"2021-09-23T01:20:11.000Z","updated_at":"2024-11-11T22:35:17.000Z","dependencies_parsed_at":"2022-11-02T00:17:02.298Z","dependency_job_id":null,"html_url":"https://github.com/GGJJack/SwiftUIWheelPicker","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GGJJack%2FSwiftUIWheelPicker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GGJJack%2FSwiftUIWheelPicker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GGJJack%2FSwiftUIWheelPicker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GGJJack%2FSwiftUIWheelPicker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/GGJJack","download_url":"https://codeload.github.com/GGJJack/SwiftUIWheelPicker/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225048981,"owners_count":17412904,"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":["cocoapods","ios","picker","swift","swiftui","swiftuihorizontalwheelpicker","swiftuiwheelpicker","wheel"],"created_at":"2024-08-03T18:00:56.812Z","updated_at":"2024-11-17T14:30:50.097Z","avatar_url":"https://github.com/GGJJack.png","language":"Swift","funding_links":[],"categories":["Picker","UI"],"sub_categories":["Content","Picker"],"readme":"# SwiftUIWheelPicker\n\n[![Version](https://img.shields.io/cocoapods/v/SwiftUIWheelPicker.svg?style=flat)](https://cocoapods.org/pods/SwiftUIWheelPicker)\n[![License](https://img.shields.io/cocoapods/l/SwiftUIWheelPicker.svg?style=flat)](https://cocoapods.org/pods/SwiftUIWheelPicker)\n[![Platform](https://img.shields.io/cocoapods/p/SwiftUIWheelPicker.svg?style=flat)](https://cocoapods.org/pods/SwiftUIWheelPicker)\n\nHorizontal wheel picker for SwiftUI\n\n## Requirements\n\niOS 13.0+\n\n## Installation\n\n\n### [CocoaPods](https://cocoapods.org)\n\n```ruby\npod 'SwiftUIWheelPicker'\n```\n\n### Import\n\n```swift\nimport SwiftUIWheelPicker\n```\n\n## Getting Started\n\n### Basic use\n\n![Basic Use](https://github.com/GGJJack/SwiftUIWheelPicker/blob/master/img/basic.gif?raw=true)\n\n```swift\n@State var indexBasic: Int = 5\n@State var items: [Int] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]\n\n...\n\nSwiftUIWheelPicker($indexBasic, items: $items) { value in\n    GeometryReader { reader in\n        Text(\"\\(value)\")\n            .frame(width: reader.size.width, height: reader.size.height, alignment: .center)\n    }\n}\n.frame(width: geometry.size.width - 40, height: 40, alignment: .center)\n.padding(.top, 10)\n```\n\n### With Visible Count\n\n![With Visible Count](https://github.com/GGJJack/SwiftUIWheelPicker/blob/master/img/with_visible_count.gif?raw=true)\n\n```swift\nSwiftUIWheelPicker($indexRatio, items: $items) { value in\n    GeometryReader { reader in\n        Text(\"\\(value)\")\n            .frame(width: reader.size.width, height: reader.size.height, alignment: .center)\n    }\n}\n.width(.Ratio(0.1))\n```\n\n```swift\npublic enum WidthOption {\n    case VisibleCount(Int) // How many items to show on the display\n    case Fixed(CGFloat) // to a fixed width\n    case Ratio(CGFloat) // From the width of the view to the ratio\n}\n```\n\n### With Alpha\n\n![With Alpha](https://github.com/GGJJack/SwiftUIWheelPicker/blob/master/img/with_alpha.gif?raw=true)\n\n```swift\nSwiftUIWheelPicker($indexAlpha, items: $items) { value in\n    GeometryReader { reader in\n        Text(\"\\(value)\")\n            .frame(width: reader.size.width, height: reader.size.height, alignment: .center)\n    }\n}\n.scrollAlpha(0.1)\n```\n\n### With Scale\n\n![With Scale](https://github.com/GGJJack/SwiftUIWheelPicker/blob/master/img/with_scale.gif?raw=true)\n\n```swift\nSwiftUIWheelPicker($indexScale, items: $items) { value in\n    GeometryReader { reader in\n        Text(\"\\(value)\")\n            .frame(width: reader.size.width, height: reader.size.height, alignment: .center)\n    }\n}\n.scrollScale(0.4)\n```\n\n### With Gradient\n\n![With Scale](https://github.com/GGJJack/SwiftUIWheelPicker/blob/master/img/with_gradient.gif?raw=true)\n\n```swift\nSwiftUIWheelPicker($indexGradient, items: $items) { value in\n    GeometryReader { reader in\n        Text(\"\\(value)\")\n            .frame(width: reader.size.width, height: reader.size.height, alignment: .center)\n    }\n}\n.edgeLeft(AnyView(\n    LinearGradient(gradient: Gradient(colors: [Color.gray.opacity(0.4), Color.white.opacity(0)]), startPoint: .leading, endPoint: .trailing)\n), width: .Ratio(0.2))\n.edgeRight(AnyView(\n    LinearGradient(gradient: Gradient(colors: [Color.white.opacity(0), Color.gray.opacity(0.4)]), startPoint: .leading, endPoint: .trailing)\n), width: .Ratio(0.2))\n```\n\n### Center indicator\n\n![Center indicator](https://github.com/GGJJack/SwiftUIWheelPicker/blob/master/img/center_indicator.gif?raw=true)\n\n```swift\nSwiftUIWheelPicker($indexIndicator, items: $items) { value in\n    GeometryReader { reader in\n        Text(\"\\(value)\")\n            .frame(width: reader.size.width, height: reader.size.height, alignment: .center)\n    }\n}\n.centerView(AnyView(\n    HStack(alignment: .center, spacing: 0) {\n        Divider()\n            .frame(width: 1)\n            .background(Color.gray)\n            .padding(EdgeInsets(top: 6, leading: 0, bottom: 6, trailing: 0))\n            .opacity(0.4)\n        Spacer()\n        Divider()\n            .frame(width: 1)\n            .background(Color.gray)\n            .padding(EdgeInsets(top: 6, leading: 0, bottom: 6, trailing: 0))\n            .opacity(0.4)\n    }\n), width: .Fixed(40))\n```\n\n### Selected Value\n\n![Selected Value](https://github.com/GGJJack/SwiftUIWheelPicker/blob/master/img/selected_value.gif?raw=true)\n\n```swift\n@State var indexValue: Int = 5\n@State var items: [Int] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]\n\nText(\"Selected Value : \\(indexValue)\").font(Font.title)\nSwiftUIWheelPicker($indexValue, items: $items) { value in\n    GeometryReader { reader in\n        Text(\"\\(value)\")\n            .frame(width: reader.size.width, height: reader.size.height, alignment: .center)\n            .background(value % 2 == 0 ? Color.blue.opacity(0.4) : Color.green.opacity(0.4))\n    }\n}\n```\n\n### Scroll To\n\n![Scroll To](https://github.com/GGJJack/SwiftUIWheelPicker/blob/master/img/scroll_to.gif?raw=true)\n\n```swift\nHStack(alignment: .bottom, spacing: 20) {\n    Text(\"Scroll To \").font(Font.title)\n    Spacer()\n    Button(\"First\") {\n        indexScrollTo = 0\n    }\n    Button(\"Center\") {\n        indexScrollTo = items.count / 2\n    }\n    Button(\"Last\") {\n        indexScrollTo = items.count - 1\n    }\n}\nSwiftUIWheelPicker($indexScrollTo, items: $items) { value in\n    GeometryReader { reader in\n        Text(\"\\(value)\")\n            .frame(width: reader.size.width, height: reader.size.height, alignment: .center)\n            .background(value % 2 == 0 ? Color.blue.opacity(0.4) : Color.green.opacity(0.4))\n    }\n}\n```\n\n## Author\n\nggaljjak, ggaljjak.choi@gmail.com\n\n## License\n\nSwiftUIWheelPicker is available under the MIT license. See the LICENSE file for more info.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FGGJJack%2FSwiftUIWheelPicker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FGGJJack%2FSwiftUIWheelPicker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FGGJJack%2FSwiftUIWheelPicker/lists"}