PickerDialog is a customizable class that displays a UIPickerView in a dialog for iOS apps. This project builds on DatePickerDialog-iOS-Swift, a date picker dialog developed by Squimer.
Copy the PickerDialog.swift
file into your project. Modify to fit your needs.
func buttonTapped() {
let pickerData = [
["value": "mile", "display": "Miles (mi)"],
["value": "kilometer", "display": "Kilometers (km)"]
]
PickerDialog().show("Distance units", options: pickerData, selected: "kilometer") {
(value) -> Void in
print("Unit selected: \(value)")
}
}
- title: String (Required)
- doneButtonTitle: String
- cancelButtonTitle: String
- selected: String (Default picker value)
- callback: ((value: String) -> Void) (Required)
- @Squimer for the DatePickerDialog-iOS-Swift project.
- @wimagguc for the work with ios-custom-alertview library.
This code is distributed under the terms and conditions of the MIT license.