     var endTime: Double
     var audioTimeStart: AVAudioTime?
     var audioFile: AKAudioFile?
-    var completion: AKRecordingResult
+    var completion: ClipRecordingCompletion
     var tap: AVAudioNodeTapBlock?
     init(start: Double = 0,
          end: Double = Double.greatestFiniteMagnitude,
          audioFile: AKAudioFile? = nil,
-         completion: @escaping AKRecordingResult) {
+         completion: @escaping ClipRecordingCompletion) {
 
         startTime = start
         endTime = end
         var called = false
-        self.completion = { (url: URL?, actualStart: Double, error: Error?) in
+        self.completion = { result in
             if called {
                 return
             }
             called = true
-            completion(url, actualStart, error)
+            completion(result)
         }
         self.audioFile = audioFile
     }

        for clip in clips {
            group.enter()
            clip.endTime = clipEndTime
            clip.completion = doAfter(result: clip.completion, action: {
                group.leave()
            })
        }
        group.notify(queue: DispatchQueue.main, execute: completion)
    }
    private func doAfter(result: @escaping AKRecordingResult,
                         action: @escaping () -> Void) -> AKRecordingResult {
        return { (url, time, error) in
            result(url, time, error)
            action()
        }
    }

        }

        guard let audioFile = clip.audioFile, audioFile.length > 0 else {
            clip.completion(ClipRecordingResult.error(error ?? ClipRecordingError.clipIsEmpty))
            completion?()
            return
        }
