<commit_before>//
//  CircularProgressIndicator.swift
//  FlingChallenge
//
//  Created by <NAME> on 9/5/16.
//  Copyright © 2016 <NAME>. All rights reserved.
//

import UIKit

@IBDesignable
class CircularProgressIndicator: UIView {

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

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

  var progress: Float = 0 {
    didSet {
      shapeLayer.path = path.CGPath

      if progress >= 1.0 && hideWhenFinished {
        hidden = true
      }
    }
  }

  var hideWhenFinished: Bool = true

  private func initialize() {
    backgroundShapeLayer.fillColor = nil
    backgroundShapeLayer.strokeColor = UIColor(white: 0, alpha: 0.5).CGColor
    backgroundShapeLayer.lineWidth = 10
    backgroundShapeLayer.addSublayer(shapeLayer)
  }

  override func layoutSubviews() {
    super.layoutSubviews()
    backgroundShapeLayer.path = UIBezierPath(ovalInRect: bounds).CGPath
  }

  override class func layerClass() -> AnyClass {
    return CAShapeLayer.self
  }

  var backgroundShapeLayer: CAShapeLayer {
    return layer as! CAShapeLayer
  }

  private(set) lazy var shapeLayer: CAShapeLayer = {
    let layer = CAShapeLayer()
    layer.fillColor = nil
    layer.strokeColor = UIColor.whiteColor().CGColor
    layer.lineWidth = 10
    return layer<commit_msg>Set hideWhenFinished property as @IBInspectable<commit_after>//
//  CircularProgressIndicator.swift
//  FlingChallenge
//
//  Created by <NAME> on 9/5/16.
//  Copyright © 2016 <NAME>. All rights reserved.
//

import UIKit

@IBDesignable
class CircularProgressIndicator: UIView {

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

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

  var progress: Float = 0 {
    didSet {
      shapeLayer.path = path.CGPath

      if progress >= 1.0 && hideWhenFinished {
        hidden = true
      }
    }
  }

  @IBInspectable
  var hideWhenFinished: Bool = true

  private func initialize() {
    backgroundShapeLayer.fillColor = nil
    backgroundShapeLayer.strokeColor = UIColor(white: 0, alpha: 0.5).CGColor
    backgroundShapeLayer.lineWidth = 10
    backgroundShapeLayer.addSublayer(shapeLayer)
  }

  override func layoutSubviews() {
    super.layoutSubviews()
    backgroundShapeLayer.path = UIBezierPath(ovalInRect: bounds).CGPath
  }

  override class func layerClass() -> AnyClass {
    return CAShapeLayer.self
  }

  var backgroundShapeLayer: CAShapeLayer {
    return layer as! CAShapeLayer
  }

  private(set) lazy var shapeLayer: CAShapeLayer = {
    let layer = CAShapeLayer()
    layer.fillColor = nil
    layer.strokeColor = UIColor.whiteColor().CGColor
    layer.lineWidth = 10
    return layer
{'fraction_non_alphanumeric': 0.09669392108069677, 'fraction_numerical': 0.012797724848915748, 'mean_word_length': 3.1750741839762613, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 11, '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': '5830046', 'n_tokens_mistral': 913, 'n_tokens_neox': 876, 'n_words': 206}