1
私はSwiftに非常に新しく、天気予報アプリを作成しようとしています。私はプロトコルfunc weatherManagerFailedToLoadCityWithError(error: ErrorType)
を持っています。 weatherManager.swiftで私は、このコードブロック天気予報アプリのエラータイププロトコル
func weatherManagerFailedToLoadCityWithError(error: ErrorType) {
}
任意の提案でweatherController.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)
})
}
}
がありますか?
あなたはこのようにそれを行うことができます