在针对iOS 7的项目中导入Alamofire [英] Importing Alamofire in Project that targets iOS 7
本文介绍了在针对iOS 7的项目中导入Alamofire的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我检查了新的Alamofire安装步骤。
I checked the new Alamofire installation steps.
由于我需要定位iOS 7.0,所以我想知道是否导入 Alamofire.swift
是否足以使其正常工作?
Since I need to target iOS 7.0 I wonder if importing the Alamofire.swift
is enough to make it works or not?
为什么文档指出将功能包装在 Struct Alamofire $ c周围$ c>?需要像在命名空间中那样调用函数吗?在那种情况下,我可以包装整个文件还是单个功能?
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?
推荐答案
您只需添加以下内容:
//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)
}
这篇关于在针对iOS 7的项目中导入Alamofire的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文