From c67964a08c535c023505c63be819d7ad49c77358 Mon Sep 17 00:00:00 2001 From: BRANDERSTUDIO Date: Thu, 30 Nov 2017 11:26:26 +0200 Subject: [PATCH] Fixed correctedContent method for nil string. --- .../TextFormatter/TextInputFormatters/TextInputFormatter.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/TextFormatter/TextInputFormatters/TextInputFormatter.swift b/Source/TextFormatter/TextInputFormatters/TextInputFormatter.swift index df560ed..987f7e8 100644 --- a/Source/TextFormatter/TextInputFormatters/TextInputFormatter.swift +++ b/Source/TextFormatter/TextInputFormatters/TextInputFormatter.swift @@ -81,7 +81,7 @@ private extension TextInputFormatter { - Returns: New String with replaced characters in range from old string */ func correctedContent(currentContent: String?, range: NSRange, replacementFiltered: String) -> String? { - guard let oldText = currentContent else { return nil } + let oldText = currentContent ?? String() let correctedRange = unformattedRange(from: range) let oldUnformatted = unformattedText(from: oldText) as NSString?