<commit_before>//
//  Premier+UIView.swift
//  PremierKit
//
//  Created by <NAME> on 20/09/2018.
//  Copyright © 2018 <NAME>. All rights reserved.
//

import UIKit

extension UIView {

    public func firstResponder() -> UIView? {
        if self.isFirstResponder {
            return self
        }
        for subview in subviews {
            if let result = subview.firstResponder() {
                return result
            }
        }
        return nil
    }

    // MARK: - AutoLayout

    public var heightLayout: NSLayoutConstraint? {
        return constraints.filter({
            $0.firstAttribute == .height &&
            $0.firstAnchor === self.heightAnchor &&
            $0.firstItem === self &&
            $0.secondItem == nil &&
            $0.secondAnchor == nil
        }).first
    }

    public var widthLayout: NSLayoutConstraint? {
        return constraints.filter({
            $0.firstAttribute == .width &&
            $0.firstAnchor === self.widthAnchor &&
            $0.firstItem === self &&
            $0.secondItem == nil &&
            $0.secondAnchor == nil
        }).first
    }

}<commit_msg>UIView: add `removeAllGestures` helper method.<commit_after>//
//  Premier+UIView.swift
//  PremierKit
//
//  Created by <NAME> on 20/09/2018.
//  Copyright © 2018 <NAME>. All rights reserved.
//

import UIKit

extension UIView {

    // MARK: - Focus

    public func firstResponder() -> UIView? {
        if self.isFirstResponder {
            return self
        }
        for subview in subviews {
            if let result = subview.firstResponder() {
                return result
            }
        }
        return nil
    }

    // MARK: - Gestures

    public func removeAllGestures() {
        gestureRecognizers?.forEach({ gesture in
            removeGestureRecognizer(gesture)
        })
    }

    // MARK: - AutoLayout

    public var heightLayout: NSLayoutConstraint? {
        return constraints.filter({
            $0.firstAttribute == .height &&
            $0.firstAnchor === self.heightAnchor &&
            $0.firstItem === self &&
            $0.secondItem == nil &&
            $0.secondAnchor == nil
        }).first
    }

    public var widthLayout: NSLayoutConstraint? {
        return constraints.filter({
            $0.firstAttribute == .width &&
            $0.firstAnchor === self.widthAnchor &&
            $0.firstItem === self &&
            $0.secondItem == nil &&
            $0.secondAnchor == nil
        }).first
    }

}
{'fraction_non_alphanumeric': 0.11900958466453675, 'fraction_numerical': 0.01757188498402556, 'mean_word_length': 1.5985477178423237, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4638029', 'n_tokens_mistral': 724, 'n_tokens_neox': 677, 'n_words': 165}