Swift - create Live Photo from mov and jpg file

1.8k Views Asked by At

I would like to create a live photo from mov and jpg files. I found the LivePhoto library https://github.com/LimitPoint/LivePhoto

When I call generate function, I get an error - " Missing argument for parameter 'completion' in call".

@IBAction func saveLivePhoto(imageUrl: URL, videoUrl: URL){

    LivePhoto.generate(from: imageUrl, videoURL: videoUrl, progress: { percent in }, completion: { livePhoto, resources in

        LivePhoto.saveToLibrary(resources!)
    })
}

What should I do to solve this problem?

1

There are 1 best solutions below

2
On BEST ANSWER

You have missed to add completion block parameter in LivePhoto.saveToLibrary function call. Try the code below:

@IBAction func saveLivePhoto(imageUrl: URL, videoUrl: URL){

        LivePhoto.generate(from: imageUrl, videoURL: videoUrl, progress: { percent in }, completion: { livePhoto, resources in

            LivePhoto.saveToLibrary(resources!) { (bool) in
                
            }
        })
    }