Sunday, November 9, 2025
HomeiOS Developmentios - Attempting to modernize and get working Apple's pattern code AVReaderWriter....

ios – Attempting to modernize and get working Apple’s pattern code AVReaderWriter. Why is that this `DispatchGroup` work block not being known as?

[ad_1]

Apple’s pattern code AVReaderWriter: Offline Audio / Video Processing has the next itemizing

    let writingGroup = dispatch_group_create()
    
    // Switch information from enter file to output file.
    self.transferVideoTracks(videoReaderOutputsAndWriterInputs, group: writingGroup)
    self.transferPassthroughTracks(passthroughReaderOutputsAndWriterInputs, group: writingGroup)
    
    // Deal with completion.
    let queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0)

    dispatch_group_notify(writingGroup, queue) {
        // `readingAndWritingDidFinish()` is assured to name `end()` precisely as soon as.
        self.readingAndWritingDidFinish(assetReader, assetWriter: assetWriter)
    }

in CynanifyOperation.swift (an NSOperation subclass that stylizes imported video and exports it). How would I get about scripting this half in fashionable Swift in order that it compiles and works?

I’ve tried scripting this as

            let writingGroup = DispatchGroup()
            
            // Switch information from enter file to output file.
            self.transferVideoTracks(videoReaderOutputsAndWriterInputs: videoReaderOutputsAndWriterInputs, group: writingGroup)
            self.transferPassthroughTracks(passthroughReaderOutputsAndWriterInputs: passthroughReaderOutputsAndWriterInputs, group: writingGroup)
            
            // Deal with completion.
            writingGroup.notify(queue: .world()) {
                // `readingAndWritingDidFinish()` is assured to name `end()` precisely as soon as.
                self.readingAndWritingDidFinish(assetReader: assetReader, assetWriter: assetWriter)
            }

Nevertheless, it is taking a particularly very long time for self.readingAndWritingDidFinish(assetReader: assetReader, assetWriter: assetWriter) to be known as, and my UI is caught within the ProgressViewController with a loading spinner. Is there one thing I wrote incorrectly or missed conceptually within the Swift 5 model?

[ad_2]

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments