<commit_before>//
//  RAMBadge.swift
//  RAMAnimatedTabBarDemo
//
//  Created by <NAME>. on 17/12/15.
//  Copyright © 2015 Ramotion. All rights reserved.
//

import UIKit

open class RAMBadge: UILabel {
    
    internal var topConstraint: NSLayoutConstraint?
    internal var centerXConstraint: NSLayoutConstraint?

    open class func badge() -> RAMBadge {
        return RAMBadge.init(frame: CGRect(x: 0, y: 0, width: 18, height: 18))
    }
    
    override public init(frame: CGRect) {
        super.init(frame: frame)
        
        layer.backgroundColor = UIColor.red.cgColor;
        layer.cornerRadius = frame.size.width / 2;
        
        configureNumberLabel()

        translatesAutoresizingMaskIntoConstraints = false
        
        // constraints
        createSizeConstraints(frame.size)

    }

    required public init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    // PRAGMA: create
    
    internal func createSizeConstraints(_ size: CGSize) {
        let widthConstraint = NSLayoutConstraint(
            item: self,
            attribute: NSLayoutAttribute.width,
            relatedBy: NSLayoutRelation.greaterThanOrEqual,
            toItem: nil,<commit_msg>Update RAMBadge.swift<commit_after>//
//  RAMBadge.swift
//  RAMAnimatedTabBarDemo
//
//  Created by <NAME>. on 17/12/15.
//  Copyright © 2015 Ramotion. All rights reserved.
//

import UIKit

open class RAMBadge: UILabel {
    
    internal var topConstraint: NSLayoutConstraint?
    internal var centerXConstraint: NSLayoutConstraint?

    open class func badge() -> RAMBadge {
        return RAMBadge.init(frame: CGRect(x: 0, y: 0, width: 18, height: 18))
    }
    
    override public init(frame: CGRect) {
        super.init(frame: frame)
        
        layer.backgroundColor = UIColor.red.cgColor;
        layer.cornerRadius = frame.size.width / 2;
        
        configureNumberLabel()

        translatesAutoresizingMaskIntoConstraints = false
        
        // constraints
        createSizeConstraints(frame.size)

    }
    
    override open var intrinsicContentSize: CGSize {
        var contentSize = super.intrinsicContentSize
        contentSize.width += 10.0
        return contentSize
    }

    required public init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    // PRAGMA: create
    
    internal func createSizeConstraints(_ size: CGSize) {
        let widthConstraint = NSLayoutConstraint(
            item: self,
            attribute: NSLayoutAttribute.width,
            relatedBy: NSLayoutRelation.greaterThanOrEqual,
            toItem: nil,
{'fraction_non_alphanumeric': 0.08744394618834081, 'fraction_numerical': 0.01382660687593423, 'mean_word_length': 2.3337484433374844, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, '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': '2135620', 'n_tokens_mistral': 811, 'n_tokens_neox': 749, 'n_words': 188}