         return end
     }
     
+    func textDidChange() {
+        
+        if let currentText = self.text, currentText != "" {
+            
+            if currentText == NSLocale.current.currencySymbol {
+                internalValue = nil
+                lastValidText = currentText
+            } else {
+                if let parsedDecimalValue = parseCurrencyString(currentText) {
+                    internalValue = parsedDecimalValue
+                    lastValidText = currentText
+                } else {
+                    self.text = lastValidText
+                }
+            }
+        } else {
+            internalValue = nil
+            lastValidText = nil
+        }
+    }
     
     
     // MARK: Helper Functions

        }
    }
    
}

    required public init?(coder aDecoder: NSCoder) {
        super.init(coder: aDecoder)
        keyboardType = .decimalPad
        self.addTarget(self, action: #selector(textDidChange), for: .editingChanged)
    }
    
    override public init(frame: CGRect) {
        super.init(frame: frame)
        keyboardType = .decimalPad
        self.addTarget(self, action: #selector(textDidChange), for: .editingChanged)
    }
    
    // Prevent the user from moving the cursor
