iteratehq/iterate-ios

View on GitHub
IterateSDK/SDK/UI/Container/Views/PassthroughView.swift

Summary

Maintainability
A
0 mins
Test Coverage
//
//  PassthroughView.swift
//  Iterate
//
//  Created by Michael Singleton on 1/6/20.
//  Copyright © 2020 Pickaxe LLC. (DBA Iterate). All rights reserved.
//

import UIKit

final class PassthroughView: UIView {
    /// Override the hit test to ignore hits on the window itself, this way it will pass through events to underlying views
    /// - Parameters:
    ///   - point: Point of hit
    ///   - event: Event that caused the hit
    override func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? {
        let view = super.hitTest(point, with: event)
        
        return view == self ? nil : view
    }
}