[ad_1]
@MainActor
class A {}
class VC: UIViewController {
let foo: A
init() {
self.foo = A() // Error: Name to important actor-isolated initializer 'init()' in a synchronous nonisolated context
tremendous.init(nibName: nil, bundle: nil)
}
@MainActor
init() {
self.foo = A() // Compiles
tremendous.init(nibName: nil, bundle: nil)
}
init(_ void: Void = ()) {
self.foo = A() // Compiles
tremendous.init(nibName: nil, bundle: nil)
}
}
I get that A() must be referred to as on a main-actor initializer, however why the primary initializer would not inherit the @MainActor from UIViewController? and why the Void parameter eliminates the error (even with -warn-concurrency)?
Word: if I annotate VC with @MainActor, I get the identical error for the tremendous.init within the first initializer, and the third initializer nonetheless works.
[ad_2]