Search code examples
iosswiftvideoswiftycam

Saving recorded video to photo library - Cannot convert value of type 'URL' to expected argument type 'String'


Hope you are well.

I am using your SwiftyCam and its very handy to create any simple camera app. The only problem I am having is I can not find any way to save the recorded video to gallery.

I tried this: UISaveVideoAtPathToSavedPhotosAlbum(url, nil, nil, nil)

But its giving me this error: Cannot convert value of type 'URL' to expected argument type 'String'

Can you suggest any solution?


Solution

  • According to signature

    func UISaveVideoAtPathToSavedPhotosAlbum(_ videoPath: String, _ completionTarget: Any?, _ completionSelector: Selector?, _ contextInfo: UnsafeMutableRawPointer?)

    You need to supply video path as String type not URL , so you can use url.path