Error : Binary operator '>=' cannot be applied to operands of type 'String.Index?' and 'Int' in swift

Solution:

To find the index of substring in a string in a particular index.Here we had an example with "t" string is in 0th position.

Code:

        let str = request.url?.absoluteString

        if str?.startIndex.distance(to:str?.index(of: "t")) != 0 {
}

Comments

Popular posts from this blog

Invalid bundle error while upload the app to the app Store

Convert NsNumber, NSDate to String in iOS Swift

Global LocationManager Singleton class iOS Swift