1
0
mirror of https://github.com/mastodon/mastodon-ios.git synced 2024-12-14 18:05:50 +01:00
mastodon-app-ufficiale-ipho.../MastodonSDK/Sources/MastodonUI/View/Container/TouchTransparentStackView.swift
2022-12-21 19:38:29 -05:00

27 lines
852 B
Swift
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

//
// TouchTransparentStackView.swift
//
//
// Created by Jed Fox on 2022-12-21.
//
import UIKit
/// A subclass of `UIStackView` that allows touches that arent captured by any
/// of its subviews to pass through to views beneath this view in the Z-order.
public class TouchTransparentStackView: UIStackView {
// allow subview hit boxes to grow outside of this views bounds
public override func point(inside point: CGPoint, with event: UIEvent?) -> Bool {
subviews.contains { $0.point(inside: $0.convert(point, from: self), with: event) }
}
// allow taps on blank areas to pass through
public override func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? {
let view = super.hitTest(point, with: event)
if view == self {
return nil
}
return view
}
}