PresentationBackgroundView.swift 653 B

123456789101112131415161718192021222324252627282930
  1. //
  2. // PassthroughBackgroundView.swift
  3. // IBAnimatable
  4. //
  5. // Created by Tom Baranes on 28/03/2017.
  6. // Copyright © 2017 IBAnimatable. All rights reserved.
  7. //
  8. import UIKit
  9. final class PresentationBackgroundView: UIView {
  10. var passthroughViews: [UIView] = []
  11. override func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? {
  12. var view = super.hitTest(point, with: event)
  13. guard view == self else {
  14. return view
  15. }
  16. for passthroughView in passthroughViews {
  17. view = passthroughView.hitTest(convert(point, to: passthroughView), with: event)
  18. if view != nil {
  19. break
  20. }
  21. }
  22. return view
  23. }
  24. }