I am sending a post request which contains an email address for the username and a password. The request works when I hard code in the email address (test@test.com) like this:
test%40test.com
However when I pass it the actual email address, it obviously doesn't work. In swift, how do I convert a string to it's HTML format (or URL format I guess). I found that iOS7 adds NSHTMLTextDocumentType which might be able to do that for me, but I can't find any examples in Swift. Here is one I found in Objective C:
NSURL *htmlString = [[NSBundle mainBundle]
URLForResource: @"helloworld" withExtension:@"html"];
NSAttributedString *stringWithHTMLAttributes = [[NSAttributedString alloc] initWithFileURL:htmlString options:@{NSDocumentTypeDocumentAttribute:NSHTMLTextDocumentType} documentAttributes:nil error:nil];
How would this work in Swift? Or if anyone has a better / easier suggestion that would work with all versions of iOS I would appreciate it. I also don't want to reference third party libraries to make this work.