kumareshm174 kumareshm174 - 1 year ago 156
iOS Question

Conversion error for rangeofcharacterfromset from swift 2.3 to swift 3.0

I am trying to convert my application from swift 2.3 to swift 3.0. I am facing the following issue.
I am trying to check whether a range of character set is found or not. Code works fine in swift 2.3 and when converting it to swift 3.0.

I get this error
Can some one help me out with this issue.
Thanks in advance.

Answer Source

This code works in playground:

let string = String()
let characterSet = CharacterSet()

let stringSet : String = string as String

stringSet.rangeOfCharacter(from: characterSet.inverted, options: String.CompareOptions.caseInsensitive)
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download