Victor17 Victor17 - 11 months ago 74
Swift Question

Displaying a Picker View selection in another ViewController in Swift

I am fairly new to Swift and am trying to have the item I select in my picker view display on a label on another screen. I know that when I want pass data from one page to another I need to use the prepareForSegue function but I cant figure out how to pass data from a picker view.


You can implement the UIPickerViewDelegate and UIPickerViewDataSource protocols to get data from the picker view.

If you're just using it as an input for a text field, you can simply just set textField.inputView = pickerView instead of having the picker view on another controller.