Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Importing Alamofire in Project that targets iOS 7

Tags:

alamofire

I checked the new Alamofire installation steps.

Since I need to target iOS 7.0 I wonder if importing the Alamofire.swift is enough to make it works or not?

Why the documentation states to wrap the functions around a Struct Alamofire? is that needed to call functions as they were within a Namespace? and in that case have I to wrap the whole file or single functions?

like image 683
MatterGoal Avatar asked Dec 03 '14 14:12

MatterGoal


1 Answers

You just have to add this:

//put this on alamofire.swift, then call it as Alamofire.manager.your_method
struct Alamofire {
static let manager = Manager.sharedInstance
}

And after you can use on this way:

Alamofire.manager.request(.GET, videoUrl, parameters: ["foo": "bar"])
            .response { (request, response, data, error) in
                println(request)
                println(response)
                println(error)
        }
like image 82
JERC Avatar answered Sep 28 '22 02:09

JERC