Search code examples
iosswiftalamofire

Alamofire requests are slow


I'm using Alamofire in my project, my problem is requests takes a long while to load (10 seconds at least), is there a way to speed it up? That's one of the requests I'm handling

override func viewDidLoad() {
    super.viewDidLoad()
    Alamofire.request(.GET, TripsEndPointURL, parameters: nil)
        .responseJSON { (request, response, JSONData, error) in
            if (error != nil) {
                NSLog("Error: \(error)")
            }
            else {
                TripsTableList = JSON(JSONData!)
                self.TripsTableView.reloadData()
            }
        }
}

Solution

  • You're using Alamofire correctly. I'd imagine this is a problem with the server, or your connection. Try replacing the endpoint URL with the url of any small image, from a different server, just to experiment with downloading it. If it's still slow, it's your connection. If it's faster, it's the server.