I have the following code in my ObservableObject class and recently XCode started giving purple coloured runtime issues with it (probably in iOS 18):
 Issue 1: Performing I/O on the main thread can cause slow launches.  
 Issue 2: Interprocess communication on the main thread can cause non-deterministic delays.
Issue 3: Interprocess communication on the main thread can cause non-deterministic delays.
Here is the code:
@Published var cameraAuthorization:AVAuthorizationStatus
@Published var micAuthorization:AVAuthorizationStatus
@Published var photoLibAuthorization:PHAuthorizationStatus
@Published var locationAuthorization:CLAuthorizationStatus
var locationManager:CLLocationManager
override init() {
    // Issue 1 (Performing I/O on the main thread can cause slow launches.)
    
    cameraAuthorization = AVCaptureDevice.authorizationStatus(for: AVMediaType.video) 
    micAuthorization = AVCaptureDevice.authorizationStatus(for: AVMediaType.audio)
    photoLibAuthorization = PHPhotoLibrary.authorizationStatus(for: .addOnly)
 //Issue 1: Performing I/O on the main thread can cause slow launches.
    locationManager = CLLocationManager()
    
    locationAuthorization = locationManager.authorizationStatus
    
    super.init()
    
  //Issue 2: Interprocess communication on the main thread can cause non-deterministic delays.
    locationManager.delegate = self
}
And also in route Change notification handler of  AVAudioSession.routeChangeNotification,
 //Issue 3: Hangs -  Interprocess communication on the main thread can cause non-deterministic delays.
    let categoryPlayback = (AVAudioSession.sharedInstance().category == .playback)
I wonder how checking authorisation status can give these issues? What is the fix here?
