Thanks for the response!
I updated the code to the initializer with the preview parameter and now the code compile but I have a problem with this unwrap URL: SentTransferredFile(URL(string: audio.url)!)
And since the url is a String, I have to use URL(string), is there any way to deal with this optional?
I was watching this session from the WWDC22, minute 9:14, and here they use another approach:
static var transferRepresentation: some TransferRepresentation {
FileRepresentation(contentType: .mpeg4Movie) {
SentTransferredFile($0.file)
} importing: { received in
let destination = try Self.copyVideoFile(source: received.file)
return Self.init(file: destination)
}
}
This makes sense but when I apply it in my own code I have problems with the line return Self.init(file: destination), since in my case I have an entity called Recording, without any variable called "File", but if I understand correctly, I must associate destination to Recording.url, is this correct?