We are using VZVirtualMachine
instances in a Swift actor. It works fine but we hit a major problem when we decided that we want to attach it to a VZVirtualMachineView
to show it / allow user interactions.
VZVirtualMachineView
and its virtualMachine
property is isolated to @MainActor
, so if we directly assign our vm
instance to it, we receive a concurrency error:
@MainActor
public func createView() -> VZVirtualMachineView {
let view = VZVirtualMachineView()
view.virtualMachine = vm // x: Actor-isolated property 'vm' can not be referenced from the main actor
return view
}
Is there any way we can make this work?