{"id":2675,"url":"https://github.com/kmcgill88/McPicker-iOS","last_synced_at":"2025-08-03T00:32:21.364Z","repository":{"id":55873018,"uuid":"85897102","full_name":"kmcgill88/McPicker-iOS","owner":"kmcgill88","description":"McPicker is a customizable, closure driven UIPickerView drop-in solution with animations that is rotation ready.","archived":false,"fork":false,"pushed_at":"2023-09-28T15:41:08.000Z","size":139,"stargazers_count":214,"open_issues_count":15,"forks_count":42,"subscribers_count":9,"default_branch":"master","last_synced_at":"2024-05-01T15:01:05.586Z","etag":null,"topics":["animation","inputview","ios","ipad","iphone","pickerview","popover","swift","swift-framework","uipickerview","uitoolbar"],"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/kmcgill88.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null},"funding":"github:[kmcgill88]"},"created_at":"2017-03-23T02:18:50.000Z","updated_at":"2024-04-13T07:22:20.000Z","dependencies_parsed_at":"2024-01-05T20:20:13.005Z","dependency_job_id":"c18f709b-3b53-4523-9662-074ce035c0c0","html_url":"https://github.com/kmcgill88/McPicker-iOS","commit_stats":{"total_commits":105,"total_committers":3,"mean_commits":35.0,"dds":0.01904761904761909,"last_synced_commit":"0a061bdc56d07e0c77afc6c8d2dc217da2f3d208"},"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kmcgill88%2FMcPicker-iOS","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kmcgill88%2FMcPicker-iOS/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kmcgill88%2FMcPicker-iOS/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kmcgill88%2FMcPicker-iOS/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kmcgill88","download_url":"https://codeload.github.com/kmcgill88/McPicker-iOS/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228510773,"owners_count":17931761,"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":["animation","inputview","ios","ipad","iphone","pickerview","popover","swift","swift-framework","uipickerview","uitoolbar"],"created_at":"2024-01-05T20:16:19.880Z","updated_at":"2024-12-06T18:30:41.571Z","avatar_url":"https://github.com/kmcgill88.png","language":"Swift","funding_links":[],"categories":["UI","📚 Projects (1974 total)"],"sub_categories":["PickerView","Other free courses","Tools \u0026 Libraries"],"readme":"# McPicker\n[![Build Status](https://travis-ci.org/kmcgill88/McPicker-iOS.svg?branch=master)](https://travis-ci.org/kmcgill88/McPicker-iOS)\n[![Version](https://img.shields.io/cocoapods/v/McPicker.svg?style=flat)](http://cocoapods.org/pods/McPicker)\n[![License](https://img.shields.io/cocoapods/l/McPicker.svg?style=flat)](http://cocoapods.org/pods/McPicker)\n[![Platform](https://img.shields.io/cocoapods/p/McPicker.svg?style=flat)](http://cocoapods.org/pods/McPicker)\n\n## About\nMcPicker is a UIPickerView drop-in solution with animations that is rotation ready. The more string arrays you pass, the more picker components you'll get. You can set custom label or use the defaults. McPicker can be presented as a Popover on iPhone or iPad using `showAsPopover`, as an `inputView` using `McTextField` or use the default slide up and down style `show`.\n\n`showAsPopover` can be used to display from a `UIView` or `UIBarButtonItem`. `showAsPopover` will always be presented as a Popover, even when used on an iPhone.\n\n## Usage\nTo run the example project, clone the repo, and run `pod install` from the Example directory first.\n\n![](https://mcgilldevtech.com/img/github/mcpicker/mcpicker-1.0.0-3.gif)\n\n#### Short Syntax\n- Normal - (Slide up from bottom)\n```swift\nMcPicker.show(data: [[\"Kevin\", \"Lauren\", \"Kibby\", \"Stella\"]]) {  [weak self] (selections: [Int : String]) -\u003e Void in\n    if let name = selections[0] {\n        self?.label.text = name\n    }\n}\n```\n- As Popover\n```swift\nlet data: [[String]] = [[\"Kevin\", \"Lauren\", \"Kibby\", \"Stella\"]]\nMcPicker.showAsPopover(data: data, fromViewController: self, barButtonItem: sender) { [weak self] (selections: [Int : String]) -\u003e Void in\n    if let name = selections[0] {\n        self?.label.text = name\n    }\n}\n```\n- As an `inputView` via `McTextField`\n```swift\n@IBOutlet weak var mcTextField: McTextField!\noverride func viewDidLoad() {\n    let data: [[String]] = [[\"Kevin\", \"Lauren\", \"Kibby\", \"Stella\"]]\n    let mcInputView = McPicker(data: data)\n    mcInputView.backgroundColor = .gray\n    mcInputView.backgroundColorAlpha = 0.25\n    mcTextField.inputViewMcPicker = mcInputView\n\n    mcTextField.doneHandler = { [weak mcTextField] (selections) in\n        mcTextField?.text = selections[0]!\n    }\n    mcTextField.selectionChangedHandler = { [weak mcTextField] (selections, componentThatChanged) in\n        mcTextField?.text = selections[componentThatChanged]!\n    }\n    mcTextField.cancelHandler = { [weak mcTextField] in\n        mcTextField?.text = \"Cancelled.\"\n    }\n    mcTextField.textFieldWillBeginEditingHandler = { [weak mcTextField] (selections) in\n        if mcTextField?.text == \"\" {\n            // Selections always default to the first value per component\n            mcTextField?.text = selections[0]\n        }\n    }\n}\n```\n\n#### Customization\n```swift\nlet data: [[String]] = [\n    [\"Sir\", \"Mr\", \"Mrs\", \"Miss\"],\n    [\"Kevin\", \"Lauren\", \"Kibby\", \"Stella\"]\n]\nlet mcPicker = McPicker(data: data)\n\nlet customLabel = UILabel()\ncustomLabel.textAlignment = .center\ncustomLabel.textColor = .white\ncustomLabel.font = UIFont(name:\"American Typewriter\", size: 30)!\nmcPicker.label = customLabel // Set your custom label\n\nlet fixedSpace = McPickerBarButtonItem.fixedSpace(width: 20.0)\nlet flexibleSpace = McPickerBarButtonItem.flexibleSpace()\nlet fireButton = McPickerBarButtonItem.done(mcPicker: mcPicker, title: \"Fire!!!\") // Set custom Text\nlet cancelButton = McPickerBarButtonItem.cancel(mcPicker: mcPicker, barButtonSystemItem: .cancel) // or system items\n// Set custom toolbar items\nmcPicker.setToolbarItems(items: [fixedSpace, cancelButton, flexibleSpace, fireButton, fixedSpace])\n\nmcPicker.toolbarItemsFont = UIFont(name:\"American Typewriter\", size: 17)!\nmcPicker.toolbarButtonsColor = .white\nmcPicker.toolbarBarTintColor = .darkGray\nmcPicker.backgroundColor = .gray\nmcPicker.backgroundColorAlpha = 0.50\nmcPicker.pickerBackgroundColor = .gray\nmcPicker.pickerSelectRowsForComponents = [\n    0: [3: true],\n    1: [2: true] // [Component: [Row: isAnimated]\n]\n\nif let barButton = sender as? UIBarButtonItem {\n    // Show as Popover\n    //\n    mcPicker.showAsPopover(fromViewController: self, barButtonItem: barButton) { [weak self] (selections: [Int : String]) -\u003e Void in\n        if let prefix = selections[0], let name = selections[1] {\n            self?.label.text = \"\\(prefix) \\(name)\"\n        }\n    }\n} else {\n    // Show Normal\n    //\n    mcPicker.show(doneHandler: { [weak self] (selections: [Int : String]) -\u003e Void in\n        if let prefix = selections[0], let name = selections[1] {\n            self?.label.text = \"\\(prefix) \\(name)\"\n        }\n    }, cancelHandler: {\n        print(\"Canceled Styled Picker\")\n    }, selectionChangedHandler: { (selections: [Int:String], componentThatChanged: Int) -\u003e Void  in\n        let newSelection = selections[componentThatChanged] ?? \"Failed to get new selection!\"\n        print(\"Component \\(componentThatChanged) changed value to \\(newSelection)\")\n    })\n}\n```\n\n##### The `selections`\nMcPicker's `doneHandler` passes back `selections: [Int : String]` as an argument. This is as simple as `[\u003cComponent Index\u003e: \u003cString of Selection\u003e]` from the `data` you've passed in.\n\n## Requirements\n- iOS 8+\n- Swift 5.2\n- Xcode 12\n\n\u003e __Note__: Starting in 0.5.1 McPicker uses the Swift 4 Compiler. [Ensure the correct compiler is set in your project.](https://github.com/kmcgill88/McPicker-iOS/issues/23). If you'd like to use Swift 3 use version \u003c=0.5.0.\n\n## Installation\n\nMcPicker is available through [CocoaPods](http://cocoapods.org). To install\nit, simply add the following line to your Podfile:\n\n```ruby\npod \"McPicker\"\n```\n\n### Xcode 12+ - Swift 5.2 Support\n```ruby\npod 'McPicker', '~\u003e 3.0.0'\n```\n\n### Swift 4.2 Support\n\nFor Swift 4.2 support, please use version `2.0.0`.\n\n```ruby\npod 'McPicker', '~\u003e 2.0.0'\n```\n\n## Author\n\nKevin McGill, kevin@mcgilldevtech.com\n\n## License\n\nMcPicker 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%2Fkmcgill88%2FMcPicker-iOS","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkmcgill88%2FMcPicker-iOS","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkmcgill88%2FMcPicker-iOS/lists"}