所以我正在使用Alamofire进行提取,并且根据索引(请参阅switch currentIndex
)我想获得一个不同的URL(有效)和一个Class(不起作用)。
类文件夹和文章都声明如下:class Folders : Mappable
和class Article : Mappable
var responseMapping:Mappable?
var URL:String = ""
switch currentIndex {
case 0:
URL = "searchFolderURL".localized + searchString
responseMapping = Folders
case 1:
URL = "searchArticleURL".localized + searchString
responseMapping = Article
default:
print("Something went horribly wrong")
guard URL != "" else {
return
}
}
print(URL)
Alamofire.request(.GET, URL).responseObject { (response: Response<responseMapping, NSError>) in
if response.result.isSuccess {
当我尝试以下代码时,它会返回下一个错误:'responseMapping' is not a type
和Cannot assign value of type 'Article.Type' to type 'Mappable?'
我在这里缺少什么?