Skip to content

Instantly share code, notes, and snippets.

@dnaismyth
Created October 28, 2017 02:07
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save dnaismyth/c2a717956220e46c4102744f47e1eac9 to your computer and use it in GitHub Desktop.
Testing Comment POST request
import UIKit
class CommentViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Create a test comment
let comment = Comment()
comment.author = "Dayna"
comment.text = "This game is cool."
let postUrl = Constants.URL.createGameComment.replacingOccurrences(of: "{gameId}", with: "1") // Create a comment on game with id = 1
Request.post(postUrl: postUrl, body: comment.convertToDictionary()) { (data) in
OperationQueue.main.addOperation {
print(data)
}
}
// Do any additional setup after loading the view.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment