Popover with Picker by Swift 3 for iPhone/iPad, iOS9+.
- Popover with Picker which can be chosen from several types, appears on iPhone or iPad.
- Swift 3, iOS9+. UIPopoverController free.
- Callback
- Swift 3, Xcode 8. (If you want to use it on Swift 2.3, please check up SwiftyPickerPopover 1.1.0.)
- iOS 9+
- CocoaPods 1.1.0.rc.2+ or Carthage 0.12.0+
MIT.
For Installing with CocoaPods, specify it in your 'Podfile'.
platform :ios, '9.0'
use_frameworks!
pod 'SwiftyPickerPopover'
Run 'pod install'.
For Installing with Carthage, add it to your Cartfile.
github "hsylife/SwiftyPickerPopover"
On Xcode, import the module.
import SwiftyPickerPopover
DatePickerPopover appears.
DatePickerPopover.appearFrom(originView: button, baseViewController: self, title: "DatePicker", dateMode: .Date, initialDate: NSDate(), doneAction: { selectedDate in print("selectedDate \(selectedDate)")}, cancelAction: {print("cancel")})
StringPickerPopover appears.
StringPickerPopover.appearFrom(originView: button, baseViewController: self, title: "StringPicker", choices: ["value 1","value 2","value 3"], initialRow:0, doneAction: { selectedRow, selectedString in print("done row \(selectedRow) \(selectedString)")} , cancelAction: { print("cancel")})
ColumnStringPickerPopover which has variable multiple components, appers.
ColumnStringPickerPopover.appearFrom(originView: button, baseViewController: self, title: "Columns Strings",
choices: [["Breakfast", "Lunch", "Dinner"], ["Tacos", "Sushi", "Steak", "Waffles", "Burgers"]],
initialRow: [0,0],
columnPercent: [0.5, 0.5],
fontSize: 12.0,
doneAction: { selectedRows, selectedStrings in print("selected rows \(selectedRows) strings \(selectedStrings)")}, cancelAction: {print("cancel")})
CountdownPickerPopover which returns interval time, appears.
CountdownPickerPopover.appearFrom(originView: sender, baseViewController: self, title: "CountdownPicker", dateMode: .countDownTimer, initialInterval: TimeInterval(), doneAction: { timeInterval in print("timeInterval \(timeInterval)")}, cancelAction: {print("cancel")})
DatePickerPopover with clearAction
DatePickerPopover.appearFrom(originView: button, baseViewController: self, title: "Clearable DatePicker", dateMode: .Date, initialDate: NSDate(), doneAction: { selectedDate in print("selectedDate \(selectedDate)")}, cancelAction: {print("cancel")}, clearAction: { print("clear")})
StringPickerPopover with displayStringFor
let displayStringFor:((String?)->String?)? = { string in
if let s = string {
switch(s){
case "value 1":
return "๐"
case "value 2":
return "๐"
case "value 3":
return "๐"
default:
return s
}
}
return nil
}
StringPickerPopover.appearFrom(originView: button, baseViewController: self, title: "StringPicker", choices: ["value 1","value 2","value 3"], displayStringFor: displayStringFor, initialRow:0, doneAction: { selectedRow, selectedString in print("done row \(selectedRow) \(selectedString)")} , cancelAction: { print("cancel")})
Ken Torimaru GitHub for CountdownPickerPopover and ColumnStringPickerPopover.