UIPageControl+Rx.swift 708 B

1234567891011121314151617181920212223242526272829303132
  1. //
  2. // UIPageControl+Rx.swift
  3. // RxCocoa
  4. //
  5. // Created by Francesco Puntillo on 14/04/2016.
  6. // Copyright © 2016 Krunoslav Zaher. All rights reserved.
  7. //
  8. #if os(iOS) || os(tvOS)
  9. import RxSwift
  10. import UIKit
  11. extension Reactive where Base: UIPageControl {
  12. /// Bindable sink for `currentPage` property.
  13. public var currentPage: Binder<Int> {
  14. return Binder(self.base) { controller, page in
  15. controller.currentPage = page
  16. }
  17. }
  18. /// Bindable sink for `numberOfPages` property.
  19. public var numberOfPages: Binder<Int> {
  20. return Binder(self.base) { controller, page in
  21. controller.numberOfPages = page
  22. }
  23. }
  24. }
  25. #endif