Search code examples
swiftxcodeuisegmentedcontrol

Swift How to know if one of my segment items is selected?


I have a segment and am wondering how to know if one of the items in the segment is selected. I do not care which one the user has chosen at this time.

EDIT

if variations.isSelected == false {
   print("none selected")
   return
}

Solution

  • Test for:

    segmentedControl.selectedSegmentIndex != UISegmentedControl.noSegment