     
     private let tapGestureRecognizer = UITapGestureRecognizer()
     private let longPressGestureRecognizer = UILongPressGestureRecognizer()
-    
     
     override public init(frame: CGRect) {
         super.init(frame: frame)

import UIKit

@objc public protocol MathInputViewDelegate: NSObjectProtocol {
    func mathInputView(_ MathInputView: MathInputView, didParse ink: [Any], latex: String)
    func mathInputView(_ MathInputView: MathInputView, didFailToParse ink: [Any], with error: NSError)
}

open class MathInputView: UIView, MathInkManagerDelegate {

    // MARK: - Touch
    
    override open func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
        guard isWritingMode else { return }
        register(touch: touches.first!)
    }
    
    override open func touchesMoved(_ touches: Set<UITouch>, with event: UIEvent?) {
        if !isWritingMode { isWritingMode = true }
        register(touch: touches.first!)
    }
    
    override open func touchesEnded(_ touches: Set<UITouch>, with event: UIEvent?) {
        guard isWritingMode else { return }
        register(touch: touches.first!, isLast: true)
        manager.process()
    }
    
    override open func touchesCancelled(_ touches: Set<UITouch>, with event: UIEvent?) {
        guard isWritingMode else { return }
        register(touch: touches.first!, isLast: true)
        manager.process()
    }
