<commit_before>//
//  SCLAlertView.swift
//  SCLAlertView Example
//
//  Created by <NAME> on 6/5/14.
//  Copyright (c) 2014 <NAME>. All rights reserved.
//

import Foundation
import UIKit

// Pop Up Styles
public enum SCLAlertViewStyle {
    case Success, Error, Notice, Warning, Info, Edit
}

// Action Types
public enum SCLActionType {
    case None, Selector, Closure
}

// Button sub-class
public class SCLButton: UIButton {
    var actionType = SCLActionType.None
    var target:AnyObject!
    var selector:Selector!
    var action:(()->Void)!

    override public init() {
        super.init()
    }

    required public init(coder aDecoder: NSCoder) {
        super.init(coder:aDecoder)
    }

    override public init(frame:CGRect) {
        super.init(frame:frame)
    }
}

// Allow alerts to be closed/renamed in a chainable manner
// Example: SCLAlertView().showSuccess(self, title: "Test", subTitle: "Value").close()
public class SCLAlertViewResponder {
    let alertview: SCLAlertView

    // Initialisation and Title/Subtitle/Close functions
    public init(alertview: SCLAlertView) {
        self.alertview = alertview
    }

    public func setTitle(title: String) {
        self.alertview.labelTitle.text = title
    }

    public func setSubTitle(subTitle: String) {
        self.alertview.viewText.text = subTitle
    }

    public func close() {
        self.alertview.hideView()
    }
}

let kCircleHeightBackground: CGFloat = 62.0

// The Main Class
public class SCLAlertView: UIViewController {
    let kDefaultShadowOpacity: CGFloat = 0.7
    let kCircleTopPosition: CGFloat = -12.0
    let kCircleBackgroundTopPosition: CGFloat = -15.0
    let kCircleHeight: CGFloat = 56.0
    let kCircleIconHeight: CGFloat = 20.0
    let kTitleTop:CGFloat = 24.0
    let kTitleHeight:CGFloat = 40.0
    let kWindowWidth: CGFloat = 240.0
    var kWindowHeight: CGFloat = 178.0
    var kTextHeight: CGFloat = 90.0

    // Font
    let kDefaultFont = "HelveticaNeue"
    let kButtonFont = "HelveticaNeue-Bold"

    // UI Colour
    var viewColor = UIColor()
    var pressBrightnessFactor = 0.85

    // Members declaration
    var baseView = UIView()
    var labelTitle = UILabel()
    var viewText = UITextView()
    var contentView = UIView()
    var circleBG = UIView(frame:CGRect(x:0, y:0, width:kCircleHeightBackground, height:kCircleHeightBackground))
    var circleView = UIView()
    var circleIconImageView = UIImageView()
    var durationTimer: NSTimer!
    private var inputs = [UITextField]()
    private var buttons = [SCLButton]()

    required public init(coder aDecoder: NSCoder) {
        fatalError("NSCoding not supported")
    }

    required override public init() {
        super.init()
        // Set up main view
        view.frame = UIScreen.mainScreen().bounds
        view.autoresizingMask = UIViewAutoresizing.FlexibleHeight | UIViewAutoresizing.FlexibleWidth
        view.backgroundColor = UIColor(red:0, green:0, blue:0, alpha:kDefaultShadowOpacity)<commit_msg>fixed init for swift 1.2<commit_after>//
//  SCLAlertView.swift
//  SCLAlertView Example
//
//  Created by <NAME> on 6/5/14.
//  Copyright (c) 2014 <NAME>. All rights reserved.
//

import Foundation
import UIKit

// Pop Up Styles
public enum SCLAlertViewStyle {
    case Success, Error, Notice, Warning, Info, Edit
}

// Action Types
public enum SCLActionType {
    case None, Selector, Closure
}

// Button sub-class
public class SCLButton: UIButton {
    var actionType = SCLActionType.None
    var target:AnyObject!
    var selector:Selector!
    var action:(()->Void)!

    public init() {
        super.init(frame: CGRectZero)
    }

    required public init(coder aDecoder: NSCoder) {
        super.init(coder:aDecoder)
    }

    override public init(frame:CGRect) {
        super.init(frame:frame)
    }
}

// Allow alerts to be closed/renamed in a chainable manner
// Example: SCLAlertView().showSuccess(self, title: "Test", subTitle: "Value").close()
public class SCLAlertViewResponder {
    let alertview: SCLAlertView

    // Initialisation and Title/Subtitle/Close functions
    public init(alertview: SCLAlertView) {
        self.alertview = alertview
    }

    public func setTitle(title: String) {
        self.alertview.labelTitle.text = title
    }

    public func setSubTitle(subTitle: String) {
        self.alertview.viewText.text = subTitle
    }

    public func close() {
        self.alertview.hideView()
    }
}

let kCircleHeightBackground: CGFloat = 62.0

// The Main Class
public class SCLAlertView: UIViewController {
    let kDefaultShadowOpacity: CGFloat = 0.7
    let kCircleTopPosition: CGFloat = -12.0
    let kCircleBackgroundTopPosition: CGFloat = -15.0
    let kCircleHeight: CGFloat = 56.0
    let kCircleIconHeight: CGFloat = 20.0
    let kTitleTop:CGFloat = 24.0
    let kTitleHeight:CGFloat = 40.0
    let kWindowWidth: CGFloat = 240.0
    var kWindowHeight: CGFloat = 178.0
    var kTextHeight: CGFloat = 90.0

    // Font
    let kDefaultFont = "HelveticaNeue"
    let kButtonFont = "HelveticaNeue-Bold"

    // UI Colour
    var viewColor = UIColor()
    var pressBrightnessFactor = 0.85

    // Members declaration
    var baseView = UIView()
    var labelTitle = UILabel()
    var viewText = UITextView()
    var contentView = UIView()
    var circleBG = UIView(frame:CGRect(x:0, y:0, width:kCircleHeightBackground, height:kCircleHeightBackground))
    var circleView = UIView()
    var circleIconImageView = UIImageView()
    var durationTimer: NSTimer!
    private var inputs = [UITextField]()
    private var buttons = [SCLButton]()

    required public init(coder aDecoder: NSCoder) {
        fatalError("NSCoding not supported")
    }

    required public init() {
        super.init(nibName:nil, bundle:nil)
        // Set up main view
        view.frame = UIScreen.mainScreen().bounds
        view.autoresizingMask = UIViewAutoresizing.FlexibleHeight | UIViewAutoresizing.FlexibleWidth
        view.backgroundColor = UIColor(red:0, green:0, blue:0, alpha:kDefaultShadowOpacity)
{'fraction_non_alphanumeric': 0.09696668324216808, 'fraction_numerical': 0.016907011437095974, 'mean_word_length': 3.0660377358490565, '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': '2329052', 'n_tokens_mistral': 2005, 'n_tokens_neox': 1903, 'n_words': 493}