XCode: 11, Swift: 5, iOS: 13
My ProgressHUD (showSuccess and showError, e.g.) only appears if I use a function a second time. After restarting the app and for example, uploading a picture, no progress image appears. When I upload a picture again, it appears. I have this behaviour for all of my progressHUD elements. Why is this happening?
Example code:
func uploadDataToDatabase(imageUrl: String) {
let databaseRef = Database.database().reference().child("posts")
let newPostId = databaseRef.childByAutoId().key
let newPostRefernce = databaseRef.child(newPostId)
let dic = ["imageUrl" : imageUrl, "postText" : postTextView.text] as [String : Any]
newPostRefernce.setValue(dic) { (error, ref) in
if error != nil {
ProgressHUD.showError("Fehler, Daten konnten nicht hochgeladen werden")
return
}
ProgressHUD.showSuccess("Post erstellt")
self.remove()
self.handleShareAndAbortButton()
self.tabBarController?.selectedIndex = 0
}
}