title: How to display only bottom border for selected item in UISegmentedControl?
body: <p>I'm extremely new to iOS development and ran into some trouble while building an app for a course.</p>
  
  <p>I created a segmented control and its init function (shown below) is being called in the view controller class containing the segmented control. I was able to remove all borders and dividers of the segmented control from the segmented control class as follows:</p>
  
  <pre><code>import Foundation
  import UIKit
  
  class CashSegmentedControl: UISegmentedControl{
  
  func initUI(){
      removeBorders()
  }
  
  func removeBorders(){
      self.tintColor = UIColor.clear
  
  }
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/fONn4.jpg" alt="This is what my result looks like currently"></p>
  
  <p>I want it to have a line under each segment WHEN the segment is selected (similar to instagram)</p>
  
  <p><img src="https://i.stack.imgur.com/93zYC.png" alt="This is a sample of what I want it to look like"></p>
  
  <p>I've searched a lot and come across some posts on StackOverflow but they seem to be for older versions of Swift. I'd really appreciate any help in this matter, and if there is a better solution for customising the borders (other than what I have done), I'd love to learn more!</p>
  
  <p>Thanks a lot :) </p>