Larme

Untitled

Sep 15th, 2021 (edited)
541
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Swift 0.33 KB | None | 0 0
  1. struct Something: Codable {
  2.     var thing: String? = nil
  3. }
  4. var request = URLRequest(URL(string: path)!)
  5. request.httpMethod = "PUT"
  6. headers.dictionary.forEach {
  7.     request.addValue(_ value: $0.value, forHTTPHeaderField: $0.key)
  8. }
  9. request.httpBody = try? JSONEncoder().encode([something])
  10. AF.request(request).responseJSON { ...}
Add Comment
Please, Sign In to add comment