 
         tintColor = normalTintColor
     }
-
 }



    // MARK: - Actions

    func handleButtonTapped(_ sender: UIButton) {
        guard let target = target,
            let action = action else {
            return
        }
        
        _ = target.perform(action, with: self)
    }

}


class AztecFormatBarButton: UIButton
{

    var selectedTintColor: UIColor?
    var highlightedTintColor: UIColor?
    var disabledTintColor: UIColor?
    var normalTintColor: UIColor?


    override var isSelected: Bool {
        didSet {
            updateTintColor()
        }
    }


    override var isHighlighted: Bool {
        didSet {
            updateTintColor()
        }
    }


    override var isEnabled: Bool {
        didSet {
            updateTintColor()
        }
    }


    func updateTintColor() {
        if state.contains(.disabled) {

import UIKit


open class FormatBarItem: UIButton {

    var selectedTintColor: UIColor?
    var highlightedTintColor: UIColor?
    var disabledTintColor: UIColor?
    var normalTintColor: UIColor?

    open var identifier: FormattingIdentifier?



    override open var tintColor: UIColor? {
        didSet {
            normalTintColor = tintColor
        }
    }


    open override var isEnabled: Bool {
        didSet {
            updateTintColor()
        }
    }


    open override var isHighlighted: Bool {
        didSet {
            updateTintColor()
        }
    }


    open override var isSelected: Bool {
        didSet {
            updateTintColor()
        }
    }



    // MARK: - Lifecycle

    public convenience init(image: UIImage, identifier: FormattingIdentifier) {
        let defaultFrame = CGRect(x: 0, y: 0, width: 44, height: 44)
        self.init(image: image, frame: defaultFrame)
        self.identifier = identifier
    }


    public init(image: UIImage, frame: CGRect) {
        super.init(frame: frame)
        self.setImage(image, for: UIControlState())
        self.adjustsImageWhenDisabled = true
        self.adjustsImageWhenHighlighted = true
    }


