Is PromiseKit 6.0 structure Correct or not?? because i am receiving an error when i running my app :(
Here's the image:
//Promise block
firstly{
removePreviusSearch(text)
}.then {(finished) -> Promise<AI> in
aiService.getAi()
}.done {(ai) -> Void in
self.updateResults(ai)
}.catch { (error) in
//catch error
}
}
// MARK : Remove previus search
func removePreviusSearch(_ newText: String) -> Promise<Bool> {
return Promise { seal in
UIView.animate(withDuration: 0.5, animations:{
self.topLabel.alpha = 0
self.mainText.alpha = 0
self.resultsView.alpha = 0
self.textField.text = ""
}, completion: { (finished: Bool) in
UIView.animate(withDuration: 0.5) {
self.topLabel.alpha = 1
self.mainText.alpha = 1
}
seal.reject(finished as! Error)
self.topLabel.text = "user says".uppercased()
self.mainText.text = newText
self.setLabel(self.cityLabel)
self.setLabel(self.streetLabel)
self.setLabel(self.countryLabel)
self.setLabel(self.dateLabel)
self.setLabel(self.speechLabel)
self.setLabel(self.itentLabel)
self.setLabel(self.conditionLabel)
self.setLabel(self.outfitLabel)
self.setLabel(self.scoreLabel)
})
}
}