<commit_before>//
//  whenTapped+UISwitch.swift
//  whenTapped
//
//  Created by <NAME> on 12/2/16.
//  Copyright © 2016 <NAME>. All rights reserved.
//

extension UISwitch {
    private struct AssociatedKeys {
        static var whenTappedKey   = "whenTappedKey"
    }
    
    public func whenTapped(handler: (() -> Void)!) {
        let aBlockClassWrapper = ClosureWrapper(closure: handler)
        objc_setAssociatedObject(self, &AssociatedKeys.whenTappedKey, aBlockClassWrapper, objc_AssociationPolicy.OBJC_ASSOCIATION_RETAIN_NONATOMIC);
        
        self.addTarget(self, action: #selector(UIButton.touchUpInside), for: UIControlEvents.touchUpInside)
    }
    
    func touchUpInside(){
        let actionBlockAnyObject = objc_getAssociatedObject(self, &AssociatedKeys.whenTappedKey) as? ClosureWrapper
        actionBlockAnyObject?.closure?()
        self.tag = 0
    }
}
<commit_msg>Fixes UISwitch target (from .touchUpInside to .valueChanged)<commit_after>//
//  whenTapped+UISwitch.swift
//  whenTapped
//
//  Created by <NAME> on 12/2/16.
//  Copyright © 2016 <NAME>. All rights reserved.
//

extension UISwitch {
    private struct AssociatedKeys {
        static var whenTappedKey   = "whenTappedKey"
    }
    
    public func whenTapped(handler: (() -> Void)!) {
        let aBlockClassWrapper = ClosureWrapper(closure: handler)
        objc_setAssociatedObject(self, &AssociatedKeys.whenTappedKey, aBlockClassWrapper, objc_AssociationPolicy.OBJC_ASSOCIATION_RETAIN_NONATOMIC);
        
        self.addTarget(self, action: #selector(UIButton.touchUpInside), for: UIControlEvents.valueChanged)
    }
    
    func touchUpInside(){
        let actionBlockAnyObject = objc_getAssociatedObject(self, &AssociatedKeys.whenTappedKey) as? ClosureWrapper
        actionBlockAnyObject?.closure?()
        self.tag = 0
    }
}

{'fraction_non_alphanumeric': 0.10130718954248366, 'fraction_numerical': 0.010893246187363835, 'mean_word_length': 3.3634204275534443, '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': '3815058', 'n_tokens_mistral': 613, 'n_tokens_neox': 575, 'n_words': 110}