title: Cannot convert value of type 'Range<String.Index>' (aka 'Range<String.CharacterView.Index>') to expected argument type 'NSRange' (aka '_NSRange')
body: <p>I am trying to replace a substring with attributed String. Following is my code.</p>
  
  <pre><code>let searchText = self.searchBar.text!
  let name = item.firstName ?? ""
  let idNo = "Employee Id. \(item.employeeId ?? "NA")"
  
  if let range = name.range(of: searchText, options: String.CompareOptions.caseInsensitive, range: nil, locale: nil)
  {
      let attributedSubString = NSAttributedString.init(string: name.substring(with: range), attributes: [NSFontAttributeName : UIFont.boldSystemFont(ofSize: 17)])
      let normalNameString = NSMutableAttributedString.init(string: name)
      normalNameString.mutableString.replacingCharacters(in: range, with: attributedSubString)
      cell.name.attributedText = normalNameString
  }
  else
  {
      cell.name.text = name
  }
  </code></pre>
  
  <p>I am getting compile time error:</p>
  
  <blockquote>
    <p>"Cannot convert value of type 'Range' (aka 'Range') to expected argument type 'NSRange' (aka '_NSRange')". </p>
  </blockquote>
  
  <p>What should I change here?</p>