//
//  ViewButtonAnimation.swift
//  WOKA
//
//  Created by Bilal on 24/05/2024.
//

import UIKit

class ViewButtonAnimation {
    
    static let sharedInstance = ViewButtonAnimation()

    private init() {}

    @objc func btnTapped(in viewController: UIViewController, view: UIView, completionHandler : @escaping () -> Void) {
        // Apply click effect animation
        UIView.animate(withDuration: 0.1, animations: {
            view.transform = CGAffineTransform(scaleX: 0.9, y: 0.9)
        }) { _ in
            UIView.animate(withDuration: 0.1) {
                view.transform = .identity
                completionHandler()
            }
        }
    }
    
    @objc func cellTapped(view: UIView, completionHandler : @escaping () -> Void) {
        // Apply click effect animation
        UIView.animate(withDuration: 0.05, animations: {
            view.transform = CGAffineTransform(scaleX: 0.95, y: 0.95)
        }) { _ in
            UIView.animate(withDuration: 0.05) {
                view.transform = .identity
                completionHandler()
            }
        }
    }
}
