I'm taking an iPhone app and making it available for Mac.
When I run the app on the Mac, the UIPicker displays nothing.
It places the cursor inside of the button and allows me to type, which is not the behavior I want (want to allow selecting from a list of options). Video in action.
I've tried putting Print statements in each of those functions (since removed) and they won't print so for whatever reason it seems like the functions themselves don't even run.
What approach(es) should I take to make a picker work on the Mac?
What am I screwing up?
What other information should I provide?
UIPicker (using UIKit):
// Mortgage Length Picker
@IBOutlet weak var mortgageLengthButton: UITextField!
func numberOfComponents(in pickerView: UIPickerView) -> Int {
return 1
}
func pickerView(_ pickerView: UIPickerView, numberOfRowsInComponent component: Int) -> Int {
return mortgageLengthData.count
}
func pickerView( _ pickerView: UIPickerView, titleForRow row: Int, forComponent component: Int) -> String? {
return mortgageLengthData[row]
}
func pickerView( _ pickerView: UIPickerView, didSelectRow row: Int, inComponent component: Int) {
mortgageLengthButton.text = mortgageLengthData[row]
let mortgageArray = mortgageLengthData[row].components(separatedBy: " ")
mortgageLengthYears = Int(mortgageArray[0]) ?? 30
calculateMortgage()
calculateCashFlow()
}
macOS 10.15.6
Xcode 12.0.1