SCNRecorder
SCNRecorder copied to clipboard
Xcode 14 Circular Reference when using SelfRecordable extension methods
Possibly a resurgence of https://github.com/gorastudio-ceo/SCNRecorder/issues/51
I'm using the latest 2.8.0 version, with clean Derived Data, and Podfile.lock
The IDE is not pinpointing the precise location of the circular reference:

Below is a shortened version of the class:
import Foundation
import SCNRecorder
import AVKit
import AVFoundation
import AssetsLibrary
@objc public class SurfaceRecorder: NSObject {
private var audioRecorder: AVAudioRecorder? = nil
private var audioURL: URL? = nil
private var methodBCaptureSession: AVCaptureSession? = nil
private var connection : AVCaptureConnection?
private var fileOutput: AVCaptureMovieFileOutput?
private var fileOutputURL: URL? = nil
private var IARView: IARSurfaceView? = nil
private var view: SCNView {
guard let view = IARView?.internalSceneView() else {
fatalError("Recording methods should be called after SurfaceView.load() method")
}
return view
}
// MARK: - Private Methods
(...)
private func startVideoRecording() -> NSError? {
FileLogger.shared.log(content: "Recording started...")
view.prepareForRecording()
do {
try view.startVideoRecording()
} catch {
FileLogger.shared.log(content: "Failed to start recording: \(error.localizedDescription)")
return NSError.error(from: error)
}
return nil
}
(...)
@objc public func stopRecording(finalFileName: String?, completionHandler handler: @escaping (NSURL?, Error?) -> Void) {
if let audioRecorder = audioRecorder {
audioRecorder.stop()
}
guard let audioURL = audioURL else {
handler(nil, nsError(withText: "Failed to obtain audio file URL", code: IARErrorCode.errorRecordVideo))
return
}
view.finishVideoRecording { [weak self] (videoRecording) in
(...)
}
}
}
Circular references are likely to be caused by these lines:
view.prepareForRecording()
// and
do {
try view.startVideoRecording()
// and
view.finishVideoRecording { [weak self] (videoRecording) in
any advices?