All Projects → kmcgill88 → Mcpicker Ios

kmcgill88 / Mcpicker Ios

Licence: mit
McPicker is a customizable, closure driven UIPickerView drop-in solution with animations that is rotation ready.

Programming Languages

swift
15916 projects

Projects that are alternatives of or similar to Mcpicker Ios

Assistantkit
Easy way to detect iOS device properties, OS versions and work with screen sizes. Powered by Swift.
Stars: ✭ 569 (+205.91%)
Mutual labels:  swift-framework, iphone, ipad
SwiftyJot
Use your finger to annotate images.
Stars: ✭ 14 (-92.47%)
Mutual labels:  iphone, ipad, swift-framework
Colorify
Colorify - simple, yet powerful color library.
Stars: ✭ 106 (-43.01%)
Mutual labels:  iphone, ipad
Device
Light weight tool for detecting the current device and screen size written in swift.
Stars: ✭ 1,503 (+708.06%)
Mutual labels:  iphone, ipad
A2hs.js
📲 A useful modern JavaScript solution that helps your website users to add (install) a progressive web application (PWA) to the Home Screen of their mobile iOS devices.
Stars: ✭ 113 (-39.25%)
Mutual labels:  iphone, ipad
Gmimagepicker.xamarin
Port of the original GMImagePicker component to Xamarin.iOS
Stars: ✭ 65 (-65.05%)
Mutual labels:  iphone, ipad
Jotify
Sticky notes reimagined - written in Swift
Stars: ✭ 79 (-57.53%)
Mutual labels:  iphone, ipad
Clendar
Clendar - universal calendar app. Written in SwiftUI. Available on App Store
Stars: ✭ 153 (-17.74%)
Mutual labels:  iphone, ipad
Chat Sdk Ios
Chat SDK iOS - Open Source Mobile Messenger
Stars: ✭ 813 (+337.1%)
Mutual labels:  iphone, ipad
Inappviewdebugger
A UIView debugger (like Reveal or Xcode) that can be embedded in an app for on-device view debugging
Stars: ✭ 1,805 (+870.43%)
Mutual labels:  iphone, ipad
Ioctocat
iOctocat v1 - GitHub for iOS (works on the iPhone, iPad, and iPod Touch)
Stars: ✭ 1,665 (+795.16%)
Mutual labels:  iphone, ipad
Unwrap
Learn Swift interactively on your iPhone.
Stars: ✭ 1,992 (+970.97%)
Mutual labels:  iphone, ipad
Responsivedevices.css
Responsive CSS Device frames for your landing pages
Stars: ✭ 59 (-68.28%)
Mutual labels:  iphone, ipad
Otganttchartkit
OTGanttChartKit is gantt chart framework for iOS. This framework use easily like UITableView.
Stars: ✭ 38 (-79.57%)
Mutual labels:  iphone, ipad
Datepicker
A Date Picker with Calendar for iPhone and iPad Apps.
Stars: ✭ 103 (-44.62%)
Mutual labels:  iphone, ipad
Numericaltextentry
An iOS library for beautiful number entry fields. iPad friendly. Written in Swift.
Stars: ✭ 16 (-91.4%)
Mutual labels:  iphone, ipad
Canijailbreak.com
a website which tells you whether you can jailbreak your iOS device.
Stars: ✭ 112 (-39.78%)
Mutual labels:  iphone, ipad
Filesystem
FileSystem is an application that allows you to browse the content of your iPhone disk, displaying file and folders, files contents, and detailed informations about file and folder permissions.
Stars: ✭ 148 (-20.43%)
Mutual labels:  iphone, ipad
Open Source Ios Apps
📱 Collaborative List of Open-Source iOS Apps
Stars: ✭ 28,826 (+15397.85%)
Mutual labels:  iphone, ipad
Blockparty
Ad Blocker App for iOS, macOS
Stars: ✭ 722 (+288.17%)
Mutual labels:  iphone, ipad

McPicker

Build Status Version License Platform

About

McPicker 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.

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.

Usage

To run the example project, clone the repo, and run pod install from the Example directory first.

Short Syntax

  • Normal - (Slide up from bottom)
McPicker.show(data: [["Kevin", "Lauren", "Kibby", "Stella"]]) {  [weak self] (selections: [Int : String]) -> Void in
    if let name = selections[0] {
        self?.label.text = name
    }
}
  • As Popover
let data: [[String]] = [["Kevin", "Lauren", "Kibby", "Stella"]]
McPicker.showAsPopover(data: data, fromViewController: self, barButtonItem: sender) { [weak self] (selections: [Int : String]) -> Void in
    if let name = selections[0] {
        self?.label.text = name
    }
}
  • As an inputView via McTextField
@IBOutlet weak var mcTextField: McTextField!
override func viewDidLoad() {
    let data: [[String]] = [["Kevin", "Lauren", "Kibby", "Stella"]]
    let mcInputView = McPicker(data: data)
    mcInputView.backgroundColor = .gray
    mcInputView.backgroundColorAlpha = 0.25
    mcTextField.inputViewMcPicker = mcInputView

    mcTextField.doneHandler = { [weak mcTextField] (selections) in
        mcTextField?.text = selections[0]!
    }
    mcTextField.selectionChangedHandler = { [weak mcTextField] (selections, componentThatChanged) in
        mcTextField?.text = selections[componentThatChanged]!
    }
    mcTextField.cancelHandler = { [weak mcTextField] in
        mcTextField?.text = "Cancelled."
    }
    mcTextField.textFieldWillBeginEditingHandler = { [weak mcTextField] (selections) in
        if mcTextField?.text == "" {
            // Selections always default to the first value per component
            mcTextField?.text = selections[0]
        }
    }
}

Customization

let data: [[String]] = [
    ["Sir", "Mr", "Mrs", "Miss"],
    ["Kevin", "Lauren", "Kibby", "Stella"]
]
let mcPicker = McPicker(data: data)

let customLabel = UILabel()
customLabel.textAlignment = .center
customLabel.textColor = .white
customLabel.font = UIFont(name:"American Typewriter", size: 30)!
mcPicker.label = customLabel // Set your custom label

let fixedSpace = McPickerBarButtonItem.fixedSpace(width: 20.0)
let flexibleSpace = McPickerBarButtonItem.flexibleSpace()
let fireButton = McPickerBarButtonItem.done(mcPicker: mcPicker, title: "Fire!!!") // Set custom Text
let cancelButton = McPickerBarButtonItem.cancel(mcPicker: mcPicker, barButtonSystemItem: .cancel) // or system items
// Set custom toolbar items
mcPicker.setToolbarItems(items: [fixedSpace, cancelButton, flexibleSpace, fireButton, fixedSpace])

mcPicker.toolbarItemsFont = UIFont(name:"American Typewriter", size: 17)!
mcPicker.toolbarButtonsColor = .white
mcPicker.toolbarBarTintColor = .darkGray
mcPicker.backgroundColor = .gray
mcPicker.backgroundColorAlpha = 0.50
mcPicker.pickerBackgroundColor = .gray
mcPicker.pickerSelectRowsForComponents = [
    0: [3: true],
    1: [2: true] // [Component: [Row: isAnimated]
]

if let barButton = sender as? UIBarButtonItem {
    // Show as Popover
    //
    mcPicker.showAsPopover(fromViewController: self, barButtonItem: barButton) { [weak self] (selections: [Int : String]) -> Void in
        if let prefix = selections[0], let name = selections[1] {
            self?.label.text = "\(prefix) \(name)"
        }
    }
} else {
    // Show Normal
    //
    mcPicker.show(doneHandler: { [weak self] (selections: [Int : String]) -> Void in
        if let prefix = selections[0], let name = selections[1] {
            self?.label.text = "\(prefix) \(name)"
        }
    }, cancelHandler: {
        print("Canceled Styled Picker")
    }, selectionChangedHandler: { (selections: [Int:String], componentThatChanged: Int) -> Void  in
        let newSelection = selections[componentThatChanged] ?? "Failed to get new selection!"
        print("Component \(componentThatChanged) changed value to \(newSelection)")
    })
}
The selections

McPicker's doneHandler passes back selections: [Int : String] as an argument. This is as simple as [<Component Index>: <String of Selection>] from the data you've passed in.

Requirements

  • iOS 8+
  • Swift 5.2
  • Xcode 12

Note: Starting in 0.5.1 McPicker uses the Swift 4 Compiler. Ensure the correct compiler is set in your project.. If you'd like to use Swift 3 use version <=0.5.0.

Installation

McPicker is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "McPicker"

Xcode 12+ - Swift 5.2 Support

pod 'McPicker', '~> 3.0.0'

Swift 4.2 Support

For Swift 4.2 support, please use version 2.0.0.

pod 'McPicker', '~> 2.0.0'

Author

Kevin McGill, [email protected]

License

McPicker is available under the MIT license. See the LICENSE file for more info.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].