Auto Login in a UIWebView in Swift

Not sure if this is the right forum. I am trying to solve the above problem. I want to create a an Auto Login for a username and password on a UIWebView. The code is below. I have tried posting this to Stackoverflow last night and as of yet I have had no responses.

import UIKit

class ViewController: UIViewController {

@IBOutlet weak var my_WebView: UIWebView!

override func viewDidLoad() {

let myURL = NSURL(string:"");
let myURLRequest:NSURLRequest = NSURLRequest(URL: myURL!);

// Do any additional setup after loading the view, typically from a nib.

func webViewDidFinishLoad(webView : UIWebView)

let savedUsername = NSUserDefaults.standardUserDefaults().stringForKey("USERNAME")
let savedPassword = NSUserDefaults.standardUserDefaults().stringForKey("PASSWORD")

if savedUsername == nil || savedPassword == nil {return}

if ( countElements(savedUsername!) != 0 && countElements(savedPassword!) != 0) {
    let loadUsernameJS = "var inputFields = document.querySelectorAll(\"input[name='username']\"); \\ for (var i = inputFields.length >>> 0; i--;) { inputFields[i].value = \'\(savedUsername)\';}"
    let loadPasswordJS = "var inputFields = document.querySelectorAll(\"input[name='password']\"); \\ for (var i = inputFields.length >>> 0; i--;) { inputFields[i].value = \'\(savedPassword)\';}"



override func didReceiveMemoryWarning() {
// Dispose of any resources that can be recreated.


I want to know how best to find the answer for the above code. Any responses would be appreciated.

What exactly is the problem?