             loadingInProgress = true
             delegate?.waveformViewWillLoad?(self)
             asset.loadValuesAsynchronously(forKeys: ["duration"]) {
-                var error: NSError? = nil
+                var error: NSError?
                 let status = asset.statusOfValue(forKey: "duration", error: &error)
                 switch status {
                 case .loaded:

    fileprivate var asset: AVAsset?

    /// The track (part of the asset) we will render
    fileprivate var assetTrack: AVAssetTrack? = nil

    /// The range of samples we rendered
    fileprivate var cachedSampleRange:CountableRange<Int> = 0..<0

    /// Gesture recognizer
    fileprivate var pinchRecognizer = UIPinchGestureRecognizer()

// @IBDesignable
open class FDWaveformView: UIView {
    /// A delegate to accept progress reporting
    @IBInspectable open weak var delegate: FDWaveformViewDelegate?

    /// The audio file to render
    @IBInspectable open var audioURL: URL? {
        didSet {
            guard let audioURL = self.audioURL else {
                NSLog("FDWaveformView failed to load URL")
