код
import UIKit
class Second_part: UIViewController,UIPickerViewDataSource, UIPickerViewDelegate {
@IBOutlet weak var wachuLike: UILabel!
@IBOutlet weak var FoodPicker: UIPickerView!
let foods = ["Indian", "Asian", "Mexican", "American", "Black"]
func numberOfComponents(in pickerView: UIPickerView) -> Int
{
return 1
}
func pickerView(_ pickerView: UIPickerView, titleForRow row: Int, forComponent component: Int) -> String?
{
return foods[row]
}
func pickerView(_ pickerView: UIPickerView, numberOfRowsInComponent component: Int) -> Int {
return foods.count
}
func pickerView(_ pickerView: UIPickerView, didSelectRow row: Int, inComponent component: Int) {
wachuLike.text = foods[row]
}
override func viewDidLoad()
{
super.viewDidLoad()
}
}