From d4ed52c2704b3eeee04d6c09b5e2d02e3c4ada7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Olcay=20Erta=C5=9F?= Date: Mon, 9 Apr 2018 14:04:57 +0300 Subject: [PATCH] Update DocumentInfo.swift Updated to Swift 4 string collections --- DocumentsOCR/Classes/Models/DocumentInfo.swift | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/DocumentsOCR/Classes/Models/DocumentInfo.swift b/DocumentsOCR/Classes/Models/DocumentInfo.swift index ace6d8c..da1b72d 100755 --- a/DocumentsOCR/Classes/Models/DocumentInfo.swift +++ b/DocumentsOCR/Classes/Models/DocumentInfo.swift @@ -55,7 +55,8 @@ open class DocumentInfo: NSObject { let regex = try! NSRegularExpression(pattern: Utils.passportPattern, options: []) - let range = NSRange(location: 0, length: text.characters.count) + let range = NSRange(location: 0, length: text.count) + if let result = regex.firstMatch(in: text, options: [], range: range) { mrCode = (text as NSString).substring(with: result.range) @@ -111,10 +112,3 @@ open class DocumentInfo: NSObject { - - - - - - -