Swift Pageged Scrollview Получить текущую страницу

// Swift 5

self.scrollView.delegate = self

// Changed the page property when the user scrolls over 50% of the current page.
// Page starts with 0
func scrollViewDidScroll(_ scrollView: UIScrollView) {
  let scrollViewWidth = scrollView.bounds.width
  self.page = Int(round(scrollView.contentOffset.x / scrollViewWidth))
}

var page: Int {
    didSet {
        guard oldValue != self.page else {
          return 
        }
      	// Handle page update
    }
}
Rens