Swift 5.1+
SwiftPicker is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'SwiftPicker'
Picker for a text
import SwiftPicker
class ViewController: UIViewController {
@IBOutlet weak var pickerContainer: UIView!
private var pickerView: SwiftTextPicker?
override func viewDidLoad() {
super.viewDidLoad()
pickerView = SwiftTextPicker(in: pickerContainer, parentViewController: self, pickerSections: [], id: "1")
pickerView?.delegate = self
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}
extension ViewController: SwiftPickerDelegate {
func onDone(name: String?, results: [PickerResult]) {
// code when press Done Button
}
func onChange(name: String?, result: PickerResult) {
//code when select item in picker
}
}
notovel2, [email protected]
SwiftPicker is available under the MIT license. See the LICENSE file for more info.