I have a file in Swift that holds all my queries. And when saving a record with saveOperation.perRecordProgressBlock
this file call ChatView view controller and updates the progressBarUpdate function.
Co far I can get the print within progressBarUpdate
to print the progress just fine. But when I get to update progressBarMessage.setProgress(value!, animated: true)
the application just crash with the following error: fatal error: unexpectedly found nil while unwrapping an Optional value
If I try to run progressBarMessage.setProgress(value!, animated: true
) through viewDidLoad
it updates the progress bar fine, no error. Which means the outlet is working just fine.
So I guess my issue is something I cannot understand when calling progressBarUpdate from my Queries.swift
file
@ my Queries.swift file
saveOperation.perRecordProgressBlock = { (recordID, progress) -> Void in
print("... perRecordProgressBlock (Float(progress))")
var chatView = ChatView()
chatView.progressBarUpdate(Float(progress))
}
@ ChatView view controller
func progressBarUpdate(value: Float)
{
print(".... perRecordProgressBlock - CHAT VIEW(value)")
if (value as? Float) != nil
{
progressBarMessage.setProgress(value, animated: true)
}
}
Aucun commentaire:
Enregistrer un commentaire