Mr E Mr E - 10 months ago 54
Swift Question

How to concatenate strings in Swift

I am trying to get USERNAME and PASSWORD from the user and put them inside of a string.

var id = "1"
var pw = "password"

Here is my code:

parser = NSXMLParser(contentsOfURL: NSURL(string : "")!)!

But it creates this result:


How do I put the values of
inside of a string?


To Concat strings in swift you have two options:

let completeURL = "\(usernameVar)&\(passwordVar)"

let completeURL = "" + usernameVar + "&" + passwordVar