Skip to content

Instantly share code, notes, and snippets.

View walis85300's full-sized avatar

Eduardo Álvarez walis85300

View GitHub Profile
@calosth
calosth / UIView+Intersection.swift
Last active September 8, 2022 22:59
Extension of UIView to detect collisions between them, including rotated(transformed) views.
import UIKit
// Conform the `Polygon` protocol to specify the vertices of the polygon.
protocol Polygon {
var vertices: [CGPoint] { get }
}
// UIView conforms the protocol `Polygon` to specified the vertices of the rectangle.
extension UIView: Polygon {