Import Alamofire into a project that targets iOS 7

I checked the new steps in installing Alamofire.

Since I need to configure iOS 7.0, I wonder if importing Alamofire.swift is enough to make it work or not?

Why Struct Alamofire documentation talk about wrapping functions around Struct Alamofire ? What do you need to call functions, as they were in the namespace? and in this case I need to wrap the whole file or individual functions?

+7
alamofire
source share
2 answers

You just need 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 this method:

 Alamofire.manager.request(.GET, videoUrl, parameters: ["foo": "bar"]) .response { (request, response, data, error) in println(request) println(response) println(error) } 
+8
source share

So, readme.md + some notes on their problems, the instructions we find wrap all top-level members in

 struct Alamofire { all original code ... } 

but actually it doesnโ€™t work that easily.

The whole file is quite large, so here is the essence (not mine) with the changes to make the main idea: https://gist.github.com/ChocolateMinht/00aa610da1b4e6c4bed6

You are right in thinking that you need to make calls as if they were placed in names.

Using the above, you can simply call Alamofire.request(...) , as if it were imported as an infrastructure in iOS 8 +

+1
source share

All Articles