Skip to content

Commit

Permalink
Merge pull request #4 from conqueror/master
Browse files Browse the repository at this point in the history
'characters' is deprecated issue fixed
  • Loading branch information
miroslavkovac authored Mar 18, 2018
2 parents 568a03b + c6e70a4 commit f21f388
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions Sources/Lingo/StringInterpolator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@ class StringInterpolator {
/// The function finds all placeholders and replaces them with a value specified in interpolations dictionary
func interpolate(_ rawString: String, with interpolations: [String: Any]) -> String {
var result = rawString

let matches = StringInterpolator.regularExpression.matches(in: rawString, options: [], range: NSRange.init(location: 0, length: rawString.characters.count))

#if swift(>=4)
let matches = StringInterpolator.regularExpression.matches(in: rawString, options: [], range: NSRange.init(location: 0, length: rawString.count))
#else
let matches = StringInterpolator.regularExpression.matches(in: rawString, options: [], range: NSRange.init(location: 0, length: rawString.characters.count))
#endif
for match in matches {
let range: NSRange = match.range

Expand Down

0 comments on commit f21f388

Please sign in to comment.