Hi Eytan! The note says
At the time of recording, Xcode 14 flags a runtime error in the location delegate continuation. If this happens to you, use Xcode 13 for the rest of Part 1.
This long after recording, itβs probably not easy to get back to Xcode 13. The Modern Concurrency book was updated in Feb 2023, and the code in Chapter 5 has a different location delegate:
class ChatLocationDelegate: NSObject, CLLocationManagerDelegate {
typealias LocationContinuation = CheckedContinuation<CLLocation, Error>
private var continuation: LocationContinuation?
init(manager: CLLocationManager, continuation: LocationContinuation) {
self.continuation = continuation
super.init()
manager.delegate = self
manager.requestWhenInUseAuthorization()
}
...
and in BlabberModel:
let location: CLLocation = try await
withCheckedThrowingContinuation { [weak self] continuation in
self?.delegate = ChatLocationDelegate(manager: manager, continuation: continuation)
if manager.authorizationStatus == .authorizedWhenInUse {
manager.startUpdatingLocation()
}
}
Even this needs further update, as now you need explicit use of self
inside the closure.