Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save feighter09/5d5103c0acf584a68e51d14f10660cfc to your computer and use it in GitHub Desktop.
Save feighter09/5d5103c0acf584a68e51d14f10660cfc to your computer and use it in GitHub Desktop.
import UIKit
import Alamofire
import SwiftyJSON
class ViewController: UIViewController {
convenience init() { self.init(nibName: "ViewController", bundle: nil) }
@IBOutlet weak var label: UILabel!
var networkClient: NetworkClientType = NetworkClient()
override func viewDidLoad()
{
super.viewDidLoad()
let url = "http://httpbin.org/post"
let params = ["param": "feighter09"]
networkClient.makeRequest(url, params: params) { json, error in
if let json = json where error == nil {
self.label.text = "Username: " + json["form"]["param"].stringValue
}
else {
self.label.text = "Request failed"
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment