<commit_before>//
//  ParticleSpinner.swift
//  Particle
//
//  Created by <NAME> on 6/24/16.
//  Copyright © 2016 particle. All rights reserved.
//

import Foundation

open class ParticleSpinner : NSObject {
    
    @objc class func show(_ view : UIView) {
        var hud : MBProgressHUD
        
        hud = MBProgressHUD.showAdded(to: view, animated: true)
        hud.mode = .customView//.Indeterminate
        hud.animationType = .zoomIn
        //            hud.labelText = "Loading"
        hud.minShowTime = 0.5
        hud.color = UIColor.clear
        
        // MBProgressHUD 1.0.0 tries:
//        hud.backgroundView.color = UIColor.clearColor()
//        hud.backgroundView.style = .SolidColor
//        hud.bezelView.backgroundColor = UIColor.clearColor()
        
        // prepare spinner view for first time populating of devices into table
        let spinnerView : UIImageView = UIImageView(image: UIImage(named: "particle-mark"))
        spinnerView.frame = CGRect(x: 0, y: 0, width: 64, height: 64);
        spinnerView.contentMode = .scaleToFill
        
        //            spinnerView.image = spinnerView.image!.imageWithRenderingMode(UIImageRenderingMode.AlwaysTemplate)
        //            spinnerView.tintColor = UIColor.whiteColor()
        
        //            UIView.animateWithDuration(1.0, delay: 0, options: .CurveEaseInOut, animations: {
        //                spinnerView.transform = CGAffineTransformRotate(spinnerView.transform, 2*CGFloat(M_PI))
        //                }, completion: nil)
        
        let rotation = CABasicAnimation(keyPath:"transform.rotation")
        rotation.fromValue = 0
        rotation.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseInEaseOut)
        rotation.toValue = 2*Double.pi;
        rotation.duration = 1;
        rotation.repeatCount = 10000; // Repeat
        spinnerView.layer.add(rotation,forKey:"Spin")
        
        hud.customView = spinnerView
        
    }

    @objc class func hide(_ view : UIView, animated: Bool = true) {
        MBProgressHUD.hide(for: view, animated: animated)
    }
    
}
<commit_msg>remove commented code in ParticleSpinner and make sure particle spinner animation does not get stopped if view is moved to background<commit_after>//
//  ParticleSpinner.swift
//  Particle
//
//  Created by <NAME> on 6/24/16.
//  Copyright © 2016 particle. All rights reserved.
//

import Foundation

open class ParticleSpinner : NSObject {
    
    @objc class func show(_ view : UIView) {
        var hud : MBProgressHUD
        
        hud = MBProgressHUD.showAdded(to: view, animated: true)
        hud.mode = .customView
        hud.animationType = .zoomIn
        hud.minShowTime = 0.5
        hud.color = UIColor.clear
        
        // prepare spinner view for first time populating of devices into table
        let spinnerView : UIImageView = UIImageView(image: UIImage(named: "particle-mark"))
        spinnerView.frame = CGRect(x: 0, y: 0, width: 64, height: 64);
        spinnerView.contentMode = .scaleToFill
        
        let rotation = CABasicAnimation(keyPath:"transform.rotation")
        rotation.isRemovedOnCompletion = false
        rotation.fromValue = 0
        rotation.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseInEaseOut)
        rotation.toValue = 2*Double.pi;
        rotation.duration = 1;
        rotation.repeatCount = 10000; // Repeat
        spinnerView.layer.add(rotation,forKey:"Spin")
        
        hud.customView = spinnerView
        
    }

    @objc class func hide(_ view : UIView, animated: Bool = true) {
        MBProgressHUD.hide(for: view, animated: animated)
    }
    
}

{'fraction_non_alphanumeric': 0.09604978354978355, 'fraction_numerical': 0.015422077922077922, 'mean_word_length': 2.2659010600706715, 'pattern_counts': {'":': 0, '<': 5, '<?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': '651454', 'n_tokens_mistral': 1153, 'n_tokens_neox': 1086, 'n_words': 252}