Which version of Xcode 16 beta is this? And are you in Swift 6 language mode?
I tried replicating your problem with Xcode 16.0b5 and I saw two different results:
-
In Swift 5 mode the code compiled just fine.
-
In Swift 6 mode I got a concurrency error which I think makes sense [1].
My code is below.
Share and Enjoy
Quinn “The Eskimo!” @ DTS @ Apple
[1] It’s centred on whether init()
is main-actor-isolated or not. Indeed, it’s exactly this issue.
import UIKit
@MainActor
class Repository {
static let shared = Repository()
}
class SelectorController: UITableViewController {
private let repository = Repository.shared
init() {
super.init(style: .grouped)
}
required init?(coder: NSCoder) {
fatalError()
}
}