<commit_before>//
//  GroupFilterButton.swift
//  SwiftListView
//
//  Created by <NAME> on 15/11/16.
//  Copyright © 2016 <NAME>. All rights reserved.
//

import OpenSansSwift

/* Group Filter Button */
class GroupFilterButton : UIView {
    
    /* Label */
    var label: UILabel!
    
    /* Button */
    var button: UIButton!
    
    /* Font */
    var font: UIFont?
    
    /* Background color */
    var bgColor: UIColor?
    
    /* Foreground Color */
    var foregroundColor: UIColor?
    
    /* Handler */
    var onSelection: ( (String) -> Void)!
    
    /* Selected Text */
    var SelectedText: String {
        get {
            return label.text!
        }
        set {
            label.text = newValue
        }
    }
    
    init() {
        super.init(frame: UIScreen.main.bounds)
        
        /* Some background settings */
        self.layer.cornerRadius = 4
        self.layer.borderWidth = 0.5
        
        self.layer.borderColor = UIColor(rgba: "#d8e3e2").cgColor
        self.backgroundColor = UIColor(rgba: "#d8e3e2")
        
        /* Button */
        button = UIButton(type: UIButtonType.system)
//        button.setBackgroundImage(GroupFilterButton.IMG, for: UIControlState())
        
        button.addTarget(self, action: #selector(GroupFilterButton.onTap), for: UIControlEvents.touchUpInside)
        button.tintColor = UIColor.white
        addSubview(button)
        button.snp.makeConstraints { (make) -> () in
            make.centerY.equalTo(self.snp.centerY)
            make.left.equalTo(self.snp.right).offset(off(-10))
            make.right.lessThanOrEqualTo(self.snp.right).offset(off(-10))
            make.width.equalTo(off(20))
            make.height.equalTo(off(20))
        }
        
        /* Label */
        label = UILabel()
        label.lineBreakMode = NSLineBreakMode.byWordWrapping
        label.font = UIFont.openSansFontOfSize(13)
        label.numberOfLines = 1
        label.textColor = UIColor(rgba: "#85a5a0")
        
        addSubview(label)
        label.snp.makeConstraints { (make) -> () in
            make.left.equalTo(off(10))
            make.right.lessThanOrEqualTo(self.button.snp.left)
            make.centerY.equalTo(self.snp.centerY)
        }
        
        /* Tap Recognizer */
        self.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(GroupFilterButton.onTap)))
    }
    
    func onTap() {
        let text = label.text?.trimmingCharacters(in: CharacterSet.whitespaces)
        onSelection(text!)
    }
    
    required init(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
}
<commit_msg>Make the class open<commit_after>//
//  GroupFilterButton.swift
//  SwiftListView
//
//  Created by <NAME> on 15/11/16.
//  Copyright © 2016 <NAME>. All rights reserved.
//

import OpenSansSwift

/* Group Filter Button */
open class GroupFilterButton : UIView {
    
    /* Label */
    var label: UILabel!
    
    /* Button */
    var button: UIButton!
    
    /* Font */
    var font: UIFont?
    
    /* Background color */
    var bgColor: UIColor?
    
    /* Foreground Color */
    var foregroundColor: UIColor?
    
    /* Handler */
    var onSelection: ( (String) -> Void)!
    
    /* Selected Text */
    var SelectedText: String {
        get {
            return label.text!
        }
        set {
            label.text = newValue
        }
    }
    
    init() {
        super.init(frame: UIScreen.main.bounds)
        
        /* Some background settings */
        self.layer.cornerRadius = 4
        self.layer.borderWidth = 0.5
        
        self.layer.borderColor = UIColor(rgba: "#d8e3e2").cgColor
        self.backgroundColor = UIColor(rgba: "#d8e3e2")
        
        /* Button */
        button = UIButton(type: UIButtonType.system)
//        button.setBackgroundImage(GroupFilterButton.IMG, for: UIControlState())
        
        button.addTarget(self, action: #selector(GroupFilterButton.onTap), for: UIControlEvents.touchUpInside)
        button.tintColor = UIColor.white
        addSubview(button)
        button.snp.makeConstraints { (make) -> () in
            make.centerY.equalTo(self.snp.centerY)
            make.left.equalTo(self.snp.right).offset(off(-10))
            make.right.lessThanOrEqualTo(self.snp.right).offset(off(-10))
            make.width.equalTo(off(20))
            make.height.equalTo(off(20))
        }
        
        /* Label */
        label = UILabel()
        label.lineBreakMode = NSLineBreakMode.byWordWrapping
        label.font = UIFont.openSansFontOfSize(13)
        label.numberOfLines = 1
        label.textColor = UIColor(rgba: "#85a5a0")
        
        addSubview(label)
        label.snp.makeConstraints { (make) -> () in
            make.left.equalTo(off(10))
            make.right.lessThanOrEqualTo(self.button.snp.left)
            make.centerY.equalTo(self.snp.centerY)
        }
        
        /* Tap Recognizer */
        self.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(GroupFilterButton.onTap)))
    }
    
    func onTap() {
        let text = label.text?.trimmingCharacters(in: CharacterSet.whitespaces)
        onSelection(text!)
    }
    
    required public init(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
}

{'fraction_non_alphanumeric': 0.1186124580380455, 'fraction_numerical': 0.013427825438269302, 'mean_word_length': 1.953193832599119, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 13, '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': '6871484', 'n_tokens_mistral': 1728, 'n_tokens_neox': 1675, 'n_words': 287}