Swift 3 SegmentedController how do I set a segment as 'selected'?

695 Views Asked by At

This should be easy (it was in Objective-C) but I've not been able to find anything through search.

I want to set a segment such as selected = true or selected = false! I won't add any code but will just say the segmentedController is connected as an IBOutlet.

1

There are 1 best solutions below

1
On

You should give segment action and in segment action you write the code it will work fine

if segment.isselected{
  //try what you want
}

else{ }