FileManager.url(forUbiquityContainerIdentifier:) is currently being called on the main thread, against Apple's guidance.
Details
At the moment you are instantiating the shared DocumentManager in the DocumentBrowserViewController.viewDidLoad (), which is happening on the main thread.
When you step through the initialisation of the DocumentManager, you eventually get to a call for the cloudDocumentsURL property which is where the call to FileManager.url(forUbiquityContainerIdentifier:) happens.
This goes against Apple's guidance for FileManager.url(forUbiquityContainerIdentifier:) that it should not be called from the main thread.
Important
Do not call this method from your app’s main thread. Because this method might take a nontrivial amount of time to set up iCloud and return the requested URL, you should always call it from a secondary thread. To determine if iCloud is available, especially at launch time, check the value of the ubiquityIdentityToken property instead.
Summary
FileManager.url(forUbiquityContainerIdentifier:)
is currently being called on the main thread, against Apple's guidance.Details
At the moment you are instantiating the shared
DocumentManager
in theDocumentBrowserViewController.viewDidLoad ()
, which is happening on the main thread.https://github.com/louisdh/textor/blob/f97306e5e97d8f204512a345a6f397d781784aec/Textor/Controller/DocumentBrowserViewController.swift#L11-L17
When you step through the initialisation of the
DocumentManager
, you eventually get to a call for thecloudDocumentsURL
property which is where the call toFileManager.url(forUbiquityContainerIdentifier:)
happens.https://github.com/louisdh/textor/blob/f97306e5e97d8f204512a345a6f397d781784aec/Textor/Util/DocumentManager.swift#L60-L66
This goes against Apple's guidance for
FileManager.url(forUbiquityContainerIdentifier:)
that it should not be called from the main thread.Link to full Apple documentation: https://developer.apple.com/documentation/foundation/filemanager/1411653-url