I see many versions of this question, but I've looked through many of them and haven't found something explaining my problem yet. I hope this isn't a repeat question.
I am simply trying to initialize an AVAssetWriter with this init! method defined in the documentation:
init!(URL outputURL: NSURL!,
fileType outputFileType: String!,
error outError: NSErrorPointer)
So I've written the following code in my playground:
var err : NSError? = nil
var outputPath = "\(NSTemporaryDirectory())mypath.mov"
var url = NSURL(fileURLWithPath: outputPath)
var fileManager = NSFileManager.defaultManager()
println("The putput path is \(outputPath)")
if(fileManager.fileExistsAtPath(outputPath))
{
fileManager.removeItemAtPath(outputPath, error: &err)
println(outputPath)
if(err != nil)
{
println("Error: \(err?.localizedDescription)")
}
}
var writeInitErr : NSError? = nil
var assetWriter = AVAssetWriter(URL: url, fileType: AVMediaTypeVideo, error: writeInitErr)
However, the last line throws the error "Extra argument 'URL' in call". None of the solutions I found in other questions about this error seem to apply here. Am I passing the wrong type to the parameter? Am I misunderstanding the use of the initializer?