My Swift is rusty; it's been a while. I tried to copy some existing, working code to a Swift package, and these errors started showing up.
/.../ScannerViewController.swift:101:23 Main actor-isolated property 'captureSession' can not be referenced from a Sendable closure
Any idea why this was compiling before, but then moving the class to a package triggers this error? I also had to add some public
keywords to the class and methods, but otherwise I changed nothing.
Relevant snippets of class:
public class ScannerViewController: UIViewController, AVCaptureMetadataOutputObjectsDelegate {
var captureSession: AVCaptureSession!
override public func viewDidLoad() {
...
DispatchQueue.global(qos: .userInitiated).async { [weak self] in
self?.captureSession.startRunning()
}