{"id":2676,"url":"https://github.com/blueapron/Mandoline","last_synced_at":"2025-08-06T15:30:50.883Z","repository":{"id":52866010,"uuid":"107487413","full_name":"blueapron/Mandoline","owner":"blueapron","description":"An iOS picker view to serve all your \"picking\" needs","archived":false,"fork":false,"pushed_at":"2019-06-15T12:29:57.000Z","size":6456,"stargazers_count":894,"open_issues_count":2,"forks_count":36,"subscribers_count":71,"default_branch":"master","last_synced_at":"2024-12-01T04:22:16.400Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://blueapron.io","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/blueapron.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":"CODEOWNERS","security":null,"support":null}},"created_at":"2017-10-19T02:21:13.000Z","updated_at":"2024-07-11T06:53:54.000Z","dependencies_parsed_at":"2022-08-23T10:40:49.497Z","dependency_job_id":null,"html_url":"https://github.com/blueapron/Mandoline","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/blueapron%2FMandoline","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blueapron%2FMandoline/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blueapron%2FMandoline/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blueapron%2FMandoline/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/blueapron","download_url":"https://codeload.github.com/blueapron/Mandoline/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228915464,"owners_count":17991409,"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":[],"created_at":"2024-01-05T20:16:19.907Z","updated_at":"2024-12-09T15:30:52.562Z","avatar_url":"https://github.com/blueapron.png","language":"Swift","funding_links":[],"categories":["UI","Libs","Swift","UI [🔝](#readme)"],"sub_categories":["PickerView","UI","Other free courses"],"readme":"# Mandoline\n\n[![Version](https://img.shields.io/cocoapods/v/Mandoline.svg?style=flat)](http://cocoapods.org/pods/Mandoline)\n[![License](https://img.shields.io/cocoapods/l/Mandoline.svg?style=flat)](http://cocoapods.org/pods/Mandoline)\n[![Platform](https://img.shields.io/cocoapods/p/Mandoline.svg?style=flat)](http://cocoapods.org/pods/Mandoline)\n[![BuddyBuild](https://dashboard.buddybuild.com/api/statusImage?appID=59ea1c9789d8e30001a447e9\u0026branch=master\u0026build=latest)](https://dashboard.buddybuild.com/apps/59ea1c9789d8e30001a447e9/build/latest?branch=master)\n\nThe `PickerView` is a `UICollectionView` that provides a smooth \"picking\" interface. In order to get the most out of it, a consuming view controller should support the `Selectable` protocol in the intended `UICollectionViewCell`s that dictates whether a cell `isSelectable`.\n\n## Why would I want to use this library?\n\nIf you want to have a _boss_ scrolling experience like this:\n\n![Blue Apron Meal Rescheduler](Mandoline/Assets/rescheduler.gif)\n\nIt also has responsive haptic feedback that is generated upon selection and moving across cells.\n\nNote: this view is optimized to display a medium-sized collection, given that its primary offering is allowing a user to scroll to a given cell that may be off the screen. One way to offset this natural requirement is to consider the intended size of the `UICollectionViewCell` that will be used.\n\n## Example\n\nTo run the example project, clone the repo, and run `pod install` from the Example directory first.\n\n## Installation\n\nPickerView is available through [CocoaPods](http://cocoapods.org). To install\nit, simply add the following line to your Podfile:\n\n```ruby\npod 'Mandoline'\n```\n\n## Usage\n\nIn the ViewController of use, you can initialize the `PickerView` like a `UIView` like so:\n\n``` swift\nlet pickerView: PickerView = {\n    let view = PickerView()\n    view.cellSize = ScrollableCell.cellSize\n    return view\n}()\n```\n\nYou'll also want to set the `PickerView`'s `dataSource` and `delegate` to `self`. Similar to a UICollectionView, be sure to `register` `YourCellClass` before the view will appear.\n\n``` swift\noverride func viewDidLoad() {\n    super.viewDidLoad()\n\n    pickerView.register(cellType: YourCellClass.self)\n    pickerView.delegate = self\n    pickerView.dataSource = self\n}\n```\n\n### `PickerViewDataSource`\n\n The `Selectable` protocol dictates whether an item is available (`isSelectable`), as observed by the size of the Overlay's dot.\n\n``` swift\npublic protocol Selectable {\n    var isSelectable: Bool { get set }\n}\n```\n\nThe `DataSource` is an array of `Selectable`'s.\n``` swift\npublic protocol PickerViewDataSource: class {\n    var selectableCells: [Selectable] { get }\n}\n```\n\n### `PickerViewDelegate`\n\nThe `PickerView` has a number of `UIScrollView` and `UICollectionView` delegate functions that can be called on the view. These are all optional.\n\n``` swift\nfunc collectionView(_ view: PickerView, didSelectItemAt indexPath: IndexPath) {\n\n}\n\nfunc scrollViewWillBeginDragging(_ view: PickerView) {\n\n}\n\nfunc scrollViewWillEndDragging(_ view: PickerView, withVelocity velocity: CGPoint, targetContentOffset: UnsafeMutablePointer\u003cCGPoint\u003e) {\n\n}\n\nfunc scrollViewDidScroll(_ scrollView: UIScrollView) {\n\n}\n```\n\nThere is also a `configure` function that is called in `collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -\u003e UICollectionViewCell` for customization of `UICollectionViewCell`s.\n\n``` swift\nfunc configure(cell: UICollectionViewCell, for: IndexPath) {\n\n}\n```\n\n### Mutable Properties\n\nThere are a number of settable properties on the PickerView:\n\n#### Required\n* `cellSize`: Set the size of the cell\n\nIf the `cellSize` is not set, the default `cellSize` from the `PickerViewCell` is used.\n\n#### Optional\n* `selectedOverlayColor`: Change the color of the overlay's border\n* `dotColor`: Change the color of the dot\n* `triangleSize`: Change the size of the picker triangle\n* `dotSize`: Change the size of the dot\n* `dotDistanceFromTop`: Change the distance of the dot from the top of the `UICollectionView`\n* `backgroundColor`: Change the background color of the `UICollectionView`\n\n## Requirements\n\n* iOS 8+\n* Xcode 8+\n\n## License\n\nMandoline is available under the MIT license. See the [LICENSE](LICENSE) file for more info.\n\n### Contributing\n\nInterested in contributing or learning more about the project? Check out our [engineering site](http://blueapron.io/) for more information.\n\n## Third-Party Licenses\n\n### SnapKit\nCopyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblueapron%2FMandoline","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fblueapron%2FMandoline","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblueapron%2FMandoline/lists"}