ESRefreshAnimator.swift 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. //
  2. // ESRefreshAnimator.swift
  3. //
  4. // Created by egg swift on 16/4/7.
  5. // Copyright (c) 2013-2016 ESPullToRefresh (https://github.com/eggswift/pull-to-refresh)
  6. //
  7. // Permission is hereby granted, free of charge, to any person obtaining a copy
  8. // of this software and associated documentation files (the "Software"), to deal
  9. // in the Software without restriction, including without limitation the rights
  10. // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  11. // copies of the Software, and to permit persons to whom the Software is
  12. // furnished to do so, subject to the following conditions:
  13. //
  14. // The above copyright notice and this permission notice shall be included in
  15. // all copies or substantial portions of the Software.
  16. //
  17. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  18. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  19. // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  20. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  21. // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  22. // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  23. // THE SOFTWARE.
  24. //
  25. import Foundation
  26. import UIKit
  27. open class ESRefreshAnimator: ESRefreshProtocol, ESRefreshAnimatorProtocol {
  28. // The view that called when component refresh, returns a custom view or self if 'self' is the customized views.
  29. open var view: UIView
  30. // Customized inset.
  31. open var insets: UIEdgeInsets
  32. // Refresh event is executed threshold required y offset, set a value greater than 0.0, the default is 60.0
  33. open var trigger: CGFloat = 60.0
  34. // Offset y refresh event executed by this parameter you can customize the animation to perform when you refresh the view of reservations height
  35. open var executeIncremental: CGFloat = 60.0
  36. // Current refresh state, default is .pullToRefresh
  37. open var state: ESRefreshViewState = .pullToRefresh
  38. public init() {
  39. view = UIView()
  40. insets = UIEdgeInsets.zero
  41. }
  42. open func refreshAnimationBegin(view: ESRefreshComponent) {
  43. /// Do nothing!
  44. }
  45. open func refreshAnimationWillEnd(view: ESRefreshComponent) {
  46. /// Do nothing!
  47. }
  48. open func refreshAnimationEnd(view: ESRefreshComponent) {
  49. /// Do nothing!
  50. }
  51. open func refresh(view: ESRefreshComponent, progressDidChange progress: CGFloat) {
  52. /// Do nothing!
  53. }
  54. open func refresh(view: ESRefreshComponent, stateDidChange state: ESRefreshViewState) {
  55. /// Do nothing!
  56. }
  57. }