UISegmentedControl error

Not sure if this is a compile error or something, but I have something that used to work (way back in the days of iOS11), and now doesn’t and since the code hasn’t changed, I’m wondering if it’s a compile issue. I have a UISegmentedControl on a tableviewcontroller, and in the ValueChanged method, this used to work:

 case UISegmentedControl(sender):selectedSegmentIndex of
   0: DataAccess.sharedInstance.settings.searchFields := searchFieldsType.all;
   1: DataAccess.sharedInstance.settings.searchFields := searchFieldsType.justBinNumbers;
   2: DataAccess.sharedInstance.settings.searchFields := searchFieldsType.justHandheldCodes;
  end;

but now it doesn’t, but if I change it to this, it works:

  if UISegmentedControl(sender):selectedSegmentIndex=0 then DataAccess.sharedInstance.settings.searchFields := searchFieldsType.all
  else if UISegmentedControl(sender):selectedSegmentIndex=1 then DataAccess.sharedInstance.settings.searchFields := searchFieldsType.justBinNumbers
  else if UISegmentedControl(sender):selectedSegmentIndex=2 then DataAccess.sharedInstance.settings.searchFields := searchFieldsType.justHandheldCodes;

does it work if you change from : to .? if so, it could be a bug with nullable ints in case.

Is there a ‘right’ place to use : as such? I use the case a lot in cellForRowAtIndexPath methods, but generally use ‘.’ in indexPath.section / indexPath.row as I know that’s Apple’s and it must exist but for things I’ve created I generally do use ‘:’ in places where I may not know and it saves checking something is assigned. Obviously I’m not always consistent!

Anyway, you’re right (this is in latest Fire btw), and I have found some other examples where

case DataAccess.sharedInstance:selectedSites.count of

and

case DataAccess.sharedInstance.selectedSites:count of

don’t work but

case DataAccess.sharedInstance.selectedSites.count of

does.

well, tis is a “right place” to use it, this is a bug. :wink:

Thanks, logged as bugs://81433

bugs://81433 got closed with status fixed.