<commit_before>//
//  IconTitleContainerView.swift
//  Yep
//
//  Created by NIX on 16/4/19.
//  Copyright © 2016年 Catch Inc. All rights reserved.
//

import UIKit

class IconTitleContainerView: UIView {

    var tapAction: (() -> Void)?
    
    lazy var iconImageView: UIImageView = {
        let imageView = UIImageView()
        imageView.image = UIImage(named: "icon_link")
        return imageView
    }()

    lazy var titleLabel: UILabel = {
        let label = UILabel()
        label.textColor = UIColor.lightGrayColor()
        label.font = UIFont.systemFontOfSize(15)
        return label
    }()

    override func didMoveToSuperview() {
        super.didMoveToSuperview()

        makeUI()

        let tap = UITapGestureRecognizer(target: self, action: #selector(IconTitleContainerView.tap(_:)))
        addGestureRecognizer(tap)
    }

    private func makeUI() {

        addSubview(iconImageView)
        addSubview(titleLabel)

        iconImageView.translatesAutoresizingMaskIntoConstraints = false
        titleLabel.translatesAutoresizingMaskIntoConstraints = false

        let views = [
            "iconImageView": iconImageView,
            "titleLabel": titleLabel,
        ]

        let constraintsH = NSLayoutConstraint.constraintsWithVisualFormat("H:|[iconImageView(20)]-5-[titleLabel]|", options: [.AlignAllCenterY], metrics: nil, views: views)
        let constraintsV = NSLayoutConstraint.constraintsWithVisualFormat("V:|[iconImageView(20)]|", options: [], metrics: nil, views: views)

        NSLayoutConstraint.activateConstraints(constraintsH)
        NSLayoutConstraint.activateConstraints(constraintsV)
    }

    @objc private func tap(sender: UITapGestureRecognizer) {
        tapAction?()
    }
}<commit_msg>better layout of IconTitleContainerView<commit_after>//
//  IconTitleContainerView.swift
//  Yep
//
//  Created by NIX on 16/4/19.
//  Copyright © 2016年 Catch Inc. All rights reserved.
//

import UIKit

class IconTitleContainerView: UIView {

    var tapAction: (() -> Void)?
    
    lazy var iconImageView: UIImageView = {
        let imageView = UIImageView()
        imageView.image = UIImage(named: "icon_link")
        return imageView
    }()

    lazy var titleLabel: UILabel = {
        let label = UILabel()
        label.textColor = UIColor.lightGrayColor()
        label.font = UIFont.systemFontOfSize(15)
        return label
    }()

    override func didMoveToSuperview() {
        super.didMoveToSuperview()

        makeUI()

        let tap = UITapGestureRecognizer(target: self, action: #selector(IconTitleContainerView.tap(_:)))
        addGestureRecognizer(tap)
    }

    private func makeUI() {

        addSubview(iconImageView)
        addSubview(titleLabel)

        iconImageView.translatesAutoresizingMaskIntoConstraints = false
        titleLabel.translatesAutoresizingMaskIntoConstraints = false

        let views = [
            "iconImageView": iconImageView,
            "titleLabel": titleLabel,
        ]

        let constraintsH = NSLayoutConstraint.constraintsWithVisualFormat("H:|[iconImageView(20)]-5-[titleLabel]|", options: [.AlignAllCenterY], metrics: nil, views: views)
        let constraintsV = NSLayoutConstraint.constraintsWithVisualFormat("V:[iconImageView(20)]", options: [], metrics: nil, views: views)

        let centerY = NSLayoutConstraint(item: iconImageView, attribute: .CenterY, relatedBy: .Equal, toItem: self, attribute: .CenterY, multiplier: 1.0, constant: 0)

        NSLayoutConstraint.activateConstraints(constraintsH)
        NSLayoutConstraint.activateConstraints(constraintsV)
        NSLayoutConstraint.activateConstraints([centerY])
    }

    @objc private func tap(sender: UITapGestureRecognizer) {
        tapAction?()
    }
}
{'fraction_non_alphanumeric': 0.1016, 'fraction_numerical': 0.009333333333333334, 'mean_word_length': 3.0595238095238093, 'pattern_counts': {'":': 4, '<': 3, '<?xml version=': 0, '>': 5, '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': '2270297', 'n_tokens_mistral': 1141, 'n_tokens_neox': 1050, 'n_words': 222}