Skip to content

Commit

Permalink
Only composit if necessary
Browse files Browse the repository at this point in the history
  • Loading branch information
bgayman committed Feb 2, 2020
1 parent 4ca7cb8 commit 522e9cd
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion Sources/FlipBook/FlipBook.swift
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,14 @@ public final class FlipBook: NSObject {
self.onCompletion?(.failure(error))
self.onCompletion = nil
} else {
let composition: ((CALayer) -> Void)?
if self.compositionAnimation != nil {
composition = { [weak self] layer in self?.compositionAnimation?(layer) }
} else {
composition = nil
}
self.writer.endLiveCapture(assetType: self.assetType,
compositionAnimation: { [weak self] layer in self?.compositionAnimation?(layer) },
compositionAnimation: composition,
progress: { [weak self] prog in DispatchQueue.main.async { self?.onProgress?(prog) }
}, completion: { [weak self] result in
guard let self = self else {
Expand Down

0 comments on commit 522e9cd

Please sign in to comment.