Swift 2.x to swift 3, XCode complaining error : Non-optional expression of type 'String' used in a check for optionals : Migrating from Swift 2.x to swift 3, I have the warning on my code :

    let response=NSString(data:data!,encoding: 
    String.Encoding.utf8.rawValue)
    let responseArray:Array=response!.components(separatedBy: "|VCSPACER|")
    if let result:String=responseArray[0]
    {
      if let action:String=responseArray[1]
      {
        if let datas:String=responseArray[2]
        {
          .......
        }
      }
    }

The compiler is warning at line :

    "if let action:String=responseArray[0]" and line "if let action:String=responseArray[1]" and "line if let datas:String=responseArray[2]"


with the message "Non-optional expression of type 'String' used in a check for optionals"

It was perfectly working on swift 2.X but not on swift 3 . What can change on this code to make it work ?

Thanks a lot.