I'm on my first project in Swift, and I need to send a RequestBody
to POST through Alamofire.
This is an example of JSON that I need to send:
{
"user":{
"email":"[email protected]"
}
}
And I have my Class User
.
func toDictionary() -> [String:Any]
{
var dictionary = [String:Any]()
if email != nil{
dictionary["email"] = email
}
return dictionary
}
I'm using SwiftyJSON
to do parse.
My question is basically how do I turn my object into that JSON framework I need and send through the Alamofire as POST.