J.M J.M - 5 months ago 27
Swift Question

How to pass two parameters in Swift

I am trying to pass in two parameters in the line

. The code works when I just implement
for the
parameter, but doesn't work when I try to add
as well. I would like to know how I can do so.

var useremail = PFUser.currentUser()?.objectForKey("username") as! String
PFCloud.callFunctionInBackground("customer", withParameters: ["token":myVal] && ["email":useremail], block: { (success: AnyObject?, error: NSError?) -> Void in


Parameters is of type Dictionary. To add an element to a Dictionary, you need to separate the key-value pairs with a comma.

So instead of:

["token":myVal] && ["email":useremail]

You want:

["token":myVal, "email":useremail]


["token":myVal] && ["email":useremail]

Will be an expression of type Bool and not of type Dictionary.