Sup, everyone... i hope you're doing good. Well, I've being coding for a short period of time and this bug came across, does anyone knows how to solve it? The intention is to have this 'file' which is a 'Auth Service', to communicate with a 'user data service' when the user present all of the information to this chat app.
The Third Image that I uploaded is what the I've being taught to to do it.*
AF.request(URL_USER_ADD, method: .post, parameters: body, encoding: JSONEncoding.default, headers: header).responseJSON { (response) in
switch response.result {
case .success(let result):
if let json = result as? Data {
guard let data = response.data else { return }
guard let json = JSON(data: data) else { return }
let id = json["_id"].stringValue
let color = json["avatarColor"].stringValue
let avatarName = json["avatarName"].stringValue
let email = json["email"].stringValue
let name = json["name"].stringValue
}
case .failure(let result):
completion(false)
debugPrint(response.result as Any)
UserDataService.instance.setUserData(id: _id, color: avatarColor, avatarName: avatarName, email: email, name: name)
completion(true)
}
}
}
}