         let replacedText = LionheartCurrencyTextField.digitRegularExpression.stringByReplacingMatches(in: _text, options: [], range: range, withTemplate: "")
         let value = NSDecimalNumber(string: replacedText)
 
-        currencyFormatter.minimumFractionDigits = 2
+        currencyFormatter.minimumFractionDigits = decimalPlaces
         text = currencyFormatter.string(from: value)
     }
     


        if let match = LionheartCurrencyTextField.decimalPointRegularExpression.firstMatch(in: replacedText, options: [], range: replacedText.range()) {
            let numbersAfterDecimal = match.range.length - 1
            currencyFormatter.minimumFractionDigits = min(2, numbersAfterDecimal)

            // If there are more than two digits after the decimal point, move the decimal place.
            // MARK: TODO Make this configurable.
            if numbersAfterDecimal > 2 {
                number = number.multiplying(byPowerOf10: Int16(numbersAfterDecimal) - 2)
            }
        } else {
            currencyFormatter.minimumFractionDigits = 0

    open static var identifier = "CurrencyTextFieldIdentifier"

    weak fileprivate var passthroughDelegate: UITextFieldDelegate?
    var decimalPlaces: Int = 2

    static let digitRegularExpression: NSRegularExpression = {
        return try! NSRegularExpression(pattern: "[^\\d\\.]", options: [])
