0

I'm trying to convert the following line of code from Swift 2 to Swift 3 while upgrading my program but I can't figure out what the equivalent is for Swift 3?

guard let password = passwordField.text!.stringByAddingPercentEncodingWithAllowedCharacters(.URLHostAllowedCharacterSet()) , !password.isEmpty else {
                    displayErrorMessage(errorMessage: "Password can not be empty!")
                    return false
                }

The error I get is:

****Value of type 'String' has no member 'stringByAddingPercentEncodingWithAllowedCharacters'****

Darren Shewry
  • 10,179
  • 4
  • 50
  • 46
Joseph Astrahan
  • 8,659
  • 12
  • 83
  • 154

0 Answers0