I'm trying to set a WKWebView
in my iOS
app and set a cookie with the authentication info but I couldn't find a way to set cookies in Swift. I saw some questions but all the answers were in Objective-C
. I tried to do some ideas for a Swift solution but I am also new in iOS development. I tried to do something like:
let request = NSMutableURLRequest(url: myUrl! as URL)
request.addValue("CookieKey=value", forHTTPHeaderField: "Cookie")
but it didn't work. When I load the page the cookies have not been set. Can any one help me?