Skip to content

Instantly share code, notes, and snippets.

@ericjames
Created November 13, 2017 21:35
Show Gist options
  • Save ericjames/4e07915ef20c5c3514a91aaef09bc3d5 to your computer and use it in GitHub Desktop.
Save ericjames/4e07915ef20c5c3514a91aaef09bc3d5 to your computer and use it in GitHub Desktop.
Swift 4 - UIPickerView
func numberOfComponents(in pickerView: UIPickerView) -> Int {
return 1
}
func pickerView(_ pickerView: UIPickerView, numberOfRowsInComponent component: Int) -> Int {
return pickerDataSource.count;
}
func pickerView(_ pickerView: UIPickerView, titleForRow row: Int, forComponent component: Int) -> String? {
return pickerDataSource[row]
}
func pickerView(_ pickerView: UIPickerView, didSelectRow row: Int, inComponent component: Int)
{
self.uuid.text = pickerDataSource[row]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment