FSPagerViewLayoutAttributes.swift 816 B

123456789101112131415161718192021222324252627282930
  1. //
  2. // FSPagerViewLayoutAttributes.swift
  3. // FSPagerViewExample
  4. //
  5. // Created by Wenchao Ding on 26/02/2017.
  6. // Copyright © 2017 Wenchao Ding. All rights reserved.
  7. //
  8. import UIKit
  9. open class FSPagerViewLayoutAttributes: UICollectionViewLayoutAttributes {
  10. open var position: CGFloat = 0
  11. open override func isEqual(_ object: Any?) -> Bool {
  12. guard let object = object as? FSPagerViewLayoutAttributes else {
  13. return false
  14. }
  15. var isEqual = super.isEqual(object)
  16. isEqual = isEqual && (self.position == object.position)
  17. return isEqual
  18. }
  19. open override func copy(with zone: NSZone? = nil) -> Any {
  20. let copy = super.copy(with: zone) as! FSPagerViewLayoutAttributes
  21. copy.position = self.position
  22. return copy
  23. }
  24. }