【发布时间】:2016-07-01 11:11:11
【问题描述】:
我对 Swift 很陌生,正在尝试创建天气应用程序。我有协议func weatherManagerFailedToLoadCityWithError(error: ErrorType)。在 weatherManager.swift 中有一些委托
} else if status == 404 {
// City not found
if self.delegate != nil {
dispatch_async(dispatch_get_main_queue(), { () -> Void in
self.delegate?.weatherManagerFailerToLoadCityWithError(.InvalidResponse)
})
}
} else {
// Some other here?
if self.delegate != nil {
dispatch_async(dispatch_get_main_queue(), { () -> Void in
self.delegate?.weatherManagerFailerToLoadCityWithError(.MissingData)
})
}
}
在这个代码块中我应该怎么做weatherController.swift
func weatherManagerFailedToLoadCityWithError(error: ErrorType) {
}
有什么建议吗?
【问题讨论】:
标签: error-handling swift2 swift-protocols