You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Here's what I suggest you do to get the Demo-CoreML project working:
Correct BostonPricer.mlmodel reference in Xcode project from ../../BostonPricer.mlmodel to ../BostonPricer.mlmodel.
Assign the ViewController instance as the picker's dataSource and delegate. This can be done either in Interface Builder (IB) or in code in ViewController.viewDidLoad():
Remove the didSet block from @IBOutlet weak var picker: UIPickerView! as it's not actually doing anything. @IBOutlets are set before any of pickerView dataSource code has run. That means the pickerView is empty when that is set and nothing happens.
Correct func pickerView(_ pickerView: UIPickerView, titleForRow row: Int, for compoenent: Int) -> String? to func pickerView(_ pickerView: UIPickerView, titleForRow row: Int, forComponent component: Int) -> String? or else it will never get called. In case it's hard to see here: for compoenent should be forComponent component.
Replace // Generate Prediction comment with actual invocation in pickerView(_ pickerView: UIPickerView, didSelectRow row: Int, inComponent component: Int). I know you were going to do this anyhow, this is just a reminder.
Fix all the AutoLayout issues... Don't feel too bad here, AutoLayout is one of the trickiest things in Xcode development. It's one part science, one part art, one part black magic. People spend years mastering it and it's always changing.
Hello @spprichard,
Here's what I suggest you do to get the Demo-CoreML project working:
Correct
BostonPricer.mlmodel
reference in Xcode project from../../BostonPricer.mlmodel
to../BostonPricer.mlmodel
.Assign the
ViewController
instance as thepicker
'sdataSource
anddelegate
. This can be done either in Interface Builder (IB) or in code inViewController.viewDidLoad()
:Remove the
didSet
block from@IBOutlet weak var picker: UIPickerView!
as it's not actually doing anything.@IBOutlet
s are set before any of pickerView dataSource code has run. That means the pickerView is empty when that is set and nothing happens.Correct
func pickerView(_ pickerView: UIPickerView, titleForRow row: Int, for compoenent: Int) -> String?
tofunc pickerView(_ pickerView: UIPickerView, titleForRow row: Int, forComponent component: Int) -> String?
or else it will never get called. In case it's hard to see here:for compoenent
should beforComponent component
.Replace
// Generate Prediction
comment with actual invocation inpickerView(_ pickerView: UIPickerView, didSelectRow row: Int, inComponent component: Int)
. I know you were going to do this anyhow, this is just a reminder.Fix all the AutoLayout issues... Don't feel too bad here, AutoLayout is one of the trickiest things in Xcode development. It's one part science, one part art, one part black magic. People spend years mastering it and it's always changing.
I suggest you attempt these fixes first, then if you want, check out my version in https://github.com/learn-swift-winnipeg/PricePredictor/tree/jeffreys-edits
Good luck!
The text was updated successfully, but these errors were encountered: