<commit_before>import UIKit

class SCButton: UIButton {
    var alreadyHighlighted = false

    required init?(coder aDecoder: NSCoder) {
        super.init(coder: aDecoder)
        self.contentEdgeInsets = UIEdgeInsetsMake(15, 25, 15, 25)
        self.setTitleColor(
            .spycodesGrayColor(),
            for: UIControlState()
        )
        self.setTitleColor(
            .white,
            for: .highlighted
        )
        self.titleLabel?.font = SCFonts.intermediateSizeFont(.regular)
        self.layer.borderColor = UIColor.spycodesGrayColor().cgColor
        self.layer.borderWidth = 2.0
        self.layer.cornerRadius = 4.0
    }

    override var isHighlighted: Bool {
        didSet {
            if isHighlighted {
                self.backgroundColor = .spycodesGrayColor()
                if !self.alreadyHighlighted {
                    SCAudioManager.playClickSound()
                    self.alreadyHighlighted = true
                }
            } else {
                self.backgroundColor = .clear
                self.alreadyHighlighted = false
            }
        }
    }
}
<commit_msg>Add haptic feedback to SCButton<commit_after>import UIKit

class SCButton: UIButton {
    var alreadyHighlighted = false

    required init?(coder aDecoder: NSCoder) {
        super.init(coder: aDecoder)
        self.contentEdgeInsets = UIEdgeInsetsMake(15, 25, 15, 25)
        self.setTitleColor(
            .spycodesGrayColor(),
            for: UIControlState()
        )
        self.setTitleColor(
            .white,
            for: .highlighted
        )
        self.titleLabel?.font = SCFonts.intermediateSizeFont(.regular)
        self.layer.borderColor = UIColor.spycodesGrayColor().cgColor
        self.layer.borderWidth = 2.0
        self.layer.cornerRadius = 4.0
        
        self.addTarget(self, action: #selector(self.onTouchDown), for: UIControlEvents.touchDown)
    }
    
    func onTouchDown() {
        if #available(iOS 10.0, *) {
            let generator = UIImpactFeedbackGenerator(style: .medium)
            generator.impactOccurred()
        }
    }

    override var isHighlighted: Bool {
        didSet {
            if isHighlighted {
                self.backgroundColor = .spycodesGrayColor()
                if !self.alreadyHighlighted {
                    SCAudioManager.playClickSound()
                    self.alreadyHighlighted = true
                }
            } else {
                self.backgroundColor = .clear
                self.alreadyHighlighted = false
            }
        }
    }
}

{'fraction_non_alphanumeric': 0.08388349514563107, 'fraction_numerical': 0.010485436893203883, 'mean_word_length': 1.6666666666666667, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '1986934', 'n_tokens_mistral': 769, 'n_tokens_neox': 699, 'n_words': 127}