Closed jameshays closed 5 years ago
Thanks!
I do have one question. Why are you using:
guard nsRange.location != NSNotFound else { return self }
Instead of just:
if nsRange.location == NSNotFound { return self }
Mainly just personal preference. To me, it reads better. If I use an “if” statement, I typically expect the body to do something. The guard is then just used more as an assert. Both accomplish the same thing in this case.
If the range location can't be found, return without attempting to add a link. This would crash previously.