     return index
   }
 }
+
+extension Onboarding : UIPageViewControllerDelegate {
+  func pageViewController(_ pageViewController: UIPageViewController,
+                          didFinishAnimating finished: Bool,
+                          previousViewControllers: [UIViewController],
+                          transitionCompleted completed: Bool) {
+    guard let index = pageViewController.dataSource?.presentationIndex?(for: pageViewController) else { return }
+    guard let count = pageViewController.dataSource?.presentationCount?(for: pageViewController) else { return }
+
+    self.control.currentPage = index
+
+    switch index {
+    case count - 1: // last screen
+      btnSkip.isHidden = true
+
+      btnContinue.setTitle(Strings.Onboarding.begin, for: .normal)
+      btnContinue.setTitleColor(Style.Colors.white, for: .normal)
+      btnContinue.backgroundColor = Style.Colors.green
+
+    case count: // complete
+      UserInfo.onboardingComplete = true
+      fallthrough
+
+    default:
+      btnSkip.isHidden = false
+
+      btnContinue.setTitle(Strings.Onboarding.continue, for: .normal)
+      btnContinue.setTitleColor(Style.Colors.green, for: .normal)
+      btnContinue.backgroundColor = Style.Colors.white
+    }
+  }
+}


  @objc
  func `continue`(sender: UIButton!) {
    guard let viewController = self.viewControllers?.first,
      let index = self.pages.firstIndex(of: viewController),
    index < self.pages.count else {
        return
    }

    // complete
    if index == self.pages.count - 1 {
      UserInfo.onboardingComplete = true
      AppController.shared.transition(to: .navigation)
      return
    }

    // continue
    setViewControllers([self.pages[index + 1]], direction: .forward,
                       animated: true, completion: nil)
    control.currentPage = index + 1

    if index + 1 == pages.count - 1 {
      self.btnSkip.isHidden = true
      self.btnContinue.setTitle(Strings.Onboarding.begin, for: .normal)
      self.btnContinue.setTitleColor(Style.Colors.white, for: .normal)
      self.btnContinue.backgroundColor = Style.Colors.green
    }
  }

  @objc


    self.view.addSubviews([control, btnContinue, btnSkip])

    control.currentPageIndicatorTintColor = Style.Colors.green
    control.pageIndicatorTintColor = Style.Colors.grey
    control.snp.makeConstraints { (make) in
      make.centerX.equalToSuperview()
