     }
 }
 
+// MARK: - UIPageViewControllerDelegate
 extension KZSegmentedPageView: UIPageViewControllerDelegate {
     public func pageViewController(_ pageViewController: UIPageViewController, willTransitionTo pendingViewControllers: [UIViewController]) {
         if let firstViewController = pendingViewControllers.first,

    
    open var segments: [KZSegmentedPageView.Segment] = [] {
        didSet {
            pageViewController.dataSource = self
            pageViewController.delegate = self
            
            if let initialViewController = segments.first?.viewController {
                scrollToViewController(initialViewController, direction: .forward)
            }
            delegate?.segmentedPageView(self, didUpdatePageCount: segments.count)
            
            segmentedControl.removeAllSegments()
            for i in 0..<segments.count {
                segmentedControl.insertSegment(withTitle: segments[i].title, at: i, animated: false)
            }
            
            segmentedControl.selectedSegmentIndex = 0
        }
    }
    

    
    @IBInspectable open var scHeight: CGFloat = 29 {
        didSet {
            self.segmentedHeighConstraint.constant = self.scHeight
            self.view.layoutIfNeeded()
        }
    }
    
    @IBInspectable open var scPaddingLeft: CGFloat = 8 {
        didSet {
            self.segmentedLeftPaddingConstraint.constant = self.scPaddingLeft
            self.view.layoutIfNeeded()
        }
    }
    
    @IBInspectable open var scPaddingRight: CGFloat = 8 {
        didSet {
            self.segmentedRightPaddingConstraint.constant = self.scPaddingRight
            self.view.layoutIfNeeded()
        }
    }
    
    @IBInspectable open var scPaddingTop: CGFloat = 8 {
        didSet {
            self.segmentedTopPaddingConstraint.constant = self.scPaddingTop
            self.view.layoutIfNeeded()
        }
    }
    
    @IBInspectable open var scPaddingBottom: CGFloat = 8 {
        didSet {
            self.segmentedBottomPaddingToPageViewControllerConstraint.constant = self.scPaddingBottom
            self.view.layoutIfNeeded()
        }
    }
    
    @IBInspectable open var scTintColor: UIColor = UIColor(colorLiteralRed: 0, green: 122/255, blue: 1, alpha: 1) {
        didSet {
            self.segmentedControl.tintColor = self.scTintColor
        }
    }
    
    @IBInspectable open var scBackgroundColor: UIColor = UIColor.clear {
        didSet {
            self.segmentedControl.backgroundColor = self.scBackgroundColor
            self.segmentedControl.clipsToBounds = true
            self.segmentedControl.layer.cornerRadius = 4
        }
    }
    
    @IBInspectable open var viewBackgroundColor: UIColor = UIColor.white {
        didSet {
            self.view.backgroundColor = self.viewBackgroundColor
        }
    }
    
