I want to create my custom UISegmentedControl like in the image below. There should be a gap between the buttons like in the screenshot. I have searched but did not get a complete solution.
Here is screenshot:

I tried this:
let items = ["Dialy", "Weekly", "Monthly"]
lazy var segmentControl: UISegmentedControl = {
let control = UISegmentedControl(items: items)
control.selectedSegmentIndex = 0
control.layer.cornerRadius = 9
control.layer.borderWidth = 1
control.layer.masksToBounds = true
control.layer.borderColor = UIColor.white.cgColor
control.addTarget(self, action: #selector(handleSegmentControl(sender:)), for:.touchUpInside)
return control
}()
```