Yeah in Swift 5 the syntax is pretty similar
string.replaceOccurrences(of: “ “, with: “%20”)
In everyday practice, I def use that method.
Typically in interviews, interviewers want to see whether the interviewee understands/can derive the algorithm which makes that method work (hence, all the code 😬🙃)
We're a place where coders share, stay up-to-date and grow their careers.
We strive for transparency and don't collect excess data.