Here is my code
@IBOutlet weak var progressBar: UIProgressView!
let progress = Progress(totalUnitCount: 10)
Updating progress bar on a button-click later:
progress.completedUnitCount += 1
let progressFloat = Float(self.progress.fractionCompleted)
self.progressBar.setProgress(progressFloat, animated: true)
The last line of code gives me
Fatal error: Unexpectedly found nil while implicitly unwrapping an Optional value
What should I do?
Welcome to Stackoverflow!
This line, this property, Xcode says it's nil!
@IBOutlet weak var progressBar: UIProgressView!
So when using IB (Interface Builder), and you experience such kind of crashes, make sure your outlets are all well connected!
Example, the image below shows the outlets are properly connected to the views in the IB.: